Procházet zdrojové kódy

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

傅行帆 před 6 roky
rodič
revize
f3286a2c4b

+ 16
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/AppApplication.java Zobrazit soubor

@@ -1,7 +1,11 @@
1 1
 package com.community.huiju;
2 2
 
3
+import com.alibaba.fastjson.serializer.SerializerFeature;
4
+import com.alibaba.fastjson.support.config.FastJsonConfig;
5
+import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
3 6
 import org.springframework.boot.SpringApplication;
4 7
 import org.springframework.boot.autoconfigure.SpringBootApplication;
8
+import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
5 9
 import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
6 10
 import org.springframework.cloud.openfeign.EnableFeignClients;
7 11
 import org.springframework.context.annotation.Bean;
@@ -22,4 +26,16 @@ public class AppApplication {
22 26
 	public RestTemplate restTemplate(){
23 27
 		return new RestTemplate();
24 28
 	}
29
+
30
+	@Bean
31
+	public HttpMessageConverters fastJsonConfigure(){
32
+		FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter();
33
+		FastJsonConfig fastJsonConfig = new FastJsonConfig();
34
+		fastJsonConfig.setSerializerFeatures(SerializerFeature.PrettyFormat);
35
+		//日期格式化
36
+		//fastJsonConfig.setDateFormat("yyyy-MM-dd HH:mm:ss");
37
+		converter.setFastJsonConfig(fastJsonConfig);
38
+		return new HttpMessageConverters(converter);
39
+	}
40
+
25 41
 }

+ 27
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/common/hk/test/OpenapiTest.java Zobrazit soubor

@@ -180,5 +180,31 @@ class OpenapiTest {
180 180
         
181 181
         return data;
182 182
 	}
183
-	
183
+
184
+
185
+
186
+	/**
187
+	 * HTTPS方式
188
+	 * 分页获取监控点信息 测试
189
+	 * @return
190
+	 * @throws Exception
191
+	 */
192
+	private static String testGetDoorEventsHistory() throws Exception{
193
+		String url = OPENAPI_IP_PORT_HTTPS + "/openapi/service/acs/event/getDoorEventsHistory";
194
+		Map<String, Object> map = new HashMap<String, Object>();
195
+		map.put("appkey", APPKEY);//设置APPKEY
196
+		map.put("time", System.currentTimeMillis());//设置时间参数
197
+		map.put("pageNo", 1);//设置分页参数
198
+		map.put("pageSize", 5);//设置分页参数
199
+		map.put("opUserUuid", OP_USER_UUID);//设置操作用户UUID
200
+		String params = JSON.toJSONString(map);
201
+		System.out.println(" ====== getCameras请求参数:【" + params + "】");
202
+		String data = HttpClientSSLUtils.doPost(url + "?token=" + Digests.buildToken(url + "?" + params, null, SECRET), params);
203
+		System.out.println(" ====== getCameras请求返回结果:【{" + data + "}】");
204
+
205
+		return data;
206
+	}
207
+
208
+
209
+
184 210
 }

+ 11
- 9
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/SocialController.java Zobrazit soubor

@@ -302,27 +302,29 @@ public class SocialController extends BaseController {
302 302
     @ApiOperation(value = "修改二手租赁帖子", notes = "修改二手租赁帖子")
303 303
     @ApiImplicitParams({
304 304
             @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value =
305
-                    "id:帖子id,imageUrl:图片url,transactionTitle:小区标题,transactionContent:小区内容"),
305
+                    "imageUrl:图片url,transactionTitle:小区标题,transactionContent:小区内容"),
306
+            @ApiImplicitParam(paramType = "path", dataType = "String", name = "id", value = "id:帖子id"),
306 307
             @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
307 308
     })
308
-    @RequestMapping(value = "/updateTransaction/{Id}", method = RequestMethod.PUT)
309
-    public ResponseBean ubdateTransaction(HttpSession session, @RequestBody String paramets) {
309
+    @RequestMapping(value = "/updateTransaction/{id}", method = RequestMethod.PUT)
310
+    public ResponseBean ubdateTransaction(HttpSession session,@PathVariable("id") String id, @RequestBody String paramets) {
310 311
         ResponseBean responseBean = new ResponseBean();
311 312
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
312 313
         Integer userId = userElement.getId();
313
-        ResponseBean response = socialServiceI.updateTransaction(paramets, userId);
314
+        ResponseBean response = socialServiceI.updateTransaction(paramets,userId,Integer.valueOf(id));
314 315
         return response;
315 316
     }
316 317
 
317 318
     @ApiOperation(value = "删除二手租赁帖子", notes = "删除二手租赁帖子")
318 319
     @ApiImplicitParams({
319
-            @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value =
320
-                    "id:帖子id"),
320
+            @ApiImplicitParam(paramType = "path", dataType = "String", name = "id", value = "id:帖子id"),
321 321
             @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
322 322
     })
323
-    @RequestMapping(value = "/deleteTransaction/{Id}", method = RequestMethod.PUT)
324
-    public ResponseBean deleteTransaction(HttpSession session, @RequestBody String paramets) {
325
-        ResponseBean response = socialServiceI.deleteransaction(paramets);
323
+    @RequestMapping(value = "/deleteTransaction/{id}", method = RequestMethod.DELETE)
324
+    public ResponseBean deleteTransaction(HttpSession session, @PathVariable("id") String id) {
325
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
326
+        Integer userId = userElement.getId();
327
+        ResponseBean response = socialServiceI.deleteransaction(Integer.valueOf(id),userId);
326 328
         return response;
327 329
     }
328 330
 

+ 2
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/UserController.java Zobrazit soubor

@@ -210,6 +210,8 @@ public class UserController extends BaseController {
210 210
         Integer id =  userElement.getId();
211 211
 
212 212
         response = iTaUserService.getUserInfo(id,userId);
213
+        TaUserVO userVO = (TaUserVO) response.getData();
214
+        userVO.setToken(session.getId());
213 215
 
214 216
         return response;
215 217
 

+ 3
- 3
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/SocialServiceI.java Zobrazit soubor

@@ -110,7 +110,7 @@ public interface SocialServiceI {
110 110
 	/**
111 111
 	 * 修改当前帖子
112 112
 	 */
113
-	ResponseBean updateTransaction(String paramets,Integer userId);
113
+	ResponseBean updateTransaction(String paramets,Integer userId,Integer id);
114 114
 
115 115
 	/**
116 116
 	 * 评价工单以及评分
@@ -138,8 +138,8 @@ public interface SocialServiceI {
138 138
 
139 139
 	/**
140 140
 	 * 删除二手租赁帖子
141
- 	 * @param paramets
141
+ 	 * @param id
142 142
 	 * @return
143 143
 	 */
144
-	ResponseBean deleteransaction(String paramets);
144
+	ResponseBean deleteransaction(Integer id,Integer userid);
145 145
 }

+ 24
- 17
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/SocialServiceImpl.java Zobrazit soubor

@@ -11,6 +11,7 @@ import com.github.pagehelper.Page;
11 11
 import com.github.pagehelper.PageHelper;
12 12
 import com.google.common.collect.Maps;
13 13
 import com.sun.org.apache.bcel.internal.generic.NEW;
14
+import org.springframework.beans.BeanUtils;
14 15
 import org.springframework.beans.factory.annotation.Autowired;
15 16
 import org.springframework.stereotype.Service;
16 17
 import org.springframework.transaction.annotation.Transactional;
@@ -383,35 +384,41 @@ public class SocialServiceImpl implements SocialServiceI {
383 384
 
384 385
     @Override
385 386
     @Transactional(rollbackFor = Exception.class)
386
-    public ResponseBean updateTransaction(String paramets,Integer userId) {
387
+    public ResponseBean updateTransaction(String paramets,Integer userId,Integer id) {
387 388
         ResponseBean response = new ResponseBean();
388 389
         JSONObject jsonObject = JSONObject.parseObject(paramets);
389
-        String id = (String) jsonObject.get("id");
390
-        String transactionTitle = (String) jsonObject.get("transactionTitle");
391
-        String transactionContent = (String) jsonObject.get("transactionContent");
392 390
         String imageUrl = (String) jsonObject.get("imageUrl");
393
-        TpTransaction tpTransaction = JSONObject.parseObject(paramets,TpTransaction.class);
394 391
 
395
-        tdImagesMapper.deleteTdImages( Integer.valueOf(id),Constant.TRANSACTION);
396
-        try {
397
-            insertTdImage(tpTransaction, imageUrl, userId,Constant.TRANSACTION);
398
-        } catch (IOException e) {
399
-            e.printStackTrace();
400
-            throw new RuntimeException("图片修改异常");
392
+        TpTransaction tpTransaction = JSONObject.parseObject(paramets, TpTransaction.class);
393
+        TpTransaction transaction = tpTransactionMapper.getById(id);
394
+        transaction.setTransactionTitle(tpTransaction.getTransactionTitle());
395
+        transaction.setTransactionContent(tpTransaction.getTransactionContent());
396
+
397
+
398
+        if (null != transaction && userId.equals(transaction.getTaUserId())) {
399
+            tdImagesMapper.deleteTdImages(Integer.valueOf(id), Constant.TRANSACTION);
400
+            try {
401
+                insertTdImage(transaction, imageUrl, userId, Constant.TRANSACTION);
402
+            } catch (IOException e) {
403
+                e.printStackTrace();
404
+                throw new RuntimeException("图片修改异常");
405
+            }
406
+            tpTransactionMapper.updateTransaction(Integer.valueOf(id), transaction.getTransactionTitle(), transaction.getTransactionContent(), userId);
407
+            response.addSuccess("修改成功");
408
+            return response;
409
+
401 410
         }
402
-        tpTransactionMapper.updateTransaction(Integer.valueOf(id),transactionTitle,transactionContent,userId);
403
-        response.addSuccess("修改成功");
411
+        response.addError("操作失败");
404 412
         return response;
405 413
     }
406 414
 
407 415
     @Override
408
-    public ResponseBean deleteransaction(String paramets) {
416
+    public ResponseBean deleteransaction(Integer id,Integer userId) {
409 417
         ResponseBean responseBean= new ResponseBean();
410
-        JSONObject jsonObject = JSONObject.parseObject(paramets);
411
-        String id = (String) jsonObject.get("id");
412 418
         TpTransaction tpTransaction=tpTransactionMapper.getById(Integer.valueOf(id));
413
-        if(null!= tpTransaction) {
419
+        if(null!= tpTransaction && userId.equals(tpTransaction.getTaUserId())) {
414 420
             tpTransaction.setStatus("0");
421
+            tpTransaction.setUpdateDate(new Date());
415 422
             tpTransactionMapper.updateByPrimaryKeySelective(tpTransaction);
416 423
             responseBean.addSuccess("删除成功");
417 424
         }else {

+ 2
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TpTicketMapper.xml Zobrazit soubor

@@ -214,6 +214,7 @@
214 214
     <include refid="Base_Column_List" />
215 215
     from tp_ticket
216 216
       <trim prefix="where" prefixOverrides="and">
217
+        and status = 1
217 218
         <if test="communityId != null" >
218 219
           and community_id = #{communityId,jdbcType=INTEGER}
219 220
         </if>
@@ -246,5 +247,6 @@
246 247
     WHERE
247 248
         t.id = #{ticketId,jdbcType=INTEGER}
248 249
         AND t.community_id = #{communityId,jdbcType=INTEGER}
250
+        and status = 1
249 251
   </select>
250 252
 </mapper>

+ 3
- 1
CODE/smart-community/app-api/src/main/resources/mapper/TpTransactionMapper.xml Zobrazit soubor

@@ -204,6 +204,7 @@ LEFT JOIN ta_sys_role sr ON sr.id = tsur.role_id
204 204
     <if test="transactionTitle != null and transactionTitle !=''">
205 205
       and transaction_title LIKE concat('%',#{transactionTitle,jdbcType=VARCHAR},'%')
206 206
     </if>
207
+    and status = 1
207 208
     order by create_date DESC
208 209
   </select>
209 210
 
@@ -216,6 +217,7 @@ LEFT JOIN ta_sys_role sr ON sr.id = tsur.role_id
216 217
     <if test="type != null and type != ''">
217 218
       and type = #{type,jdbcType=INTEGER}
218 219
     </if>
220
+    and status = 1
219 221
     order by create_date DESC
220 222
   </select>
221 223
 
@@ -234,6 +236,6 @@ LEFT JOIN ta_sys_role sr ON sr.id = tsur.role_id
234 236
     select
235 237
     <include refid="Base_Column_List" />
236 238
     from tp_transaction
237
-    where id = #{id,jdbcType=INTEGER}
239
+    where id = #{id,jdbcType=INTEGER} and status = 1
238 240
   </select>
239 241
 </mapper>

+ 16
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/controller/AppUserController.java Zobrazit soubor

@@ -0,0 +1,16 @@
1
+package com.community.huiju.controller;
2
+
3
+import io.swagger.annotations.Api;
4
+import org.springframework.cloud.context.config.annotation.RefreshScope;
5
+import org.springframework.web.bind.annotation.RequestMapping;
6
+import org.springframework.web.bind.annotation.RestController;
7
+
8
+@RestController
9
+@RefreshScope
10
+@RequestMapping("/")
11
+@Api(value = " App 用户 控制器")
12
+public class AppUserController {
13
+
14
+
15
+
16
+}

+ 85
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/dao/TaUserMapper.java Zobrazit soubor

@@ -0,0 +1,85 @@
1
+package com.community.huiju.dao;
2
+
3
+import com.community.huiju.model.TaUser;
4
+import org.apache.ibatis.annotations.Mapper;
5
+import org.apache.ibatis.annotations.Param;
6
+
7
+import java.util.List;
8
+import java.util.Map;
9
+
10
+@Mapper
11
+public interface TaUserMapper {
12
+    int deleteByPrimaryKey(Integer id);
13
+
14
+    int insert(TaUser record);
15
+
16
+    int insertSelective(TaUser record);
17
+
18
+    TaUser selectByPrimaryKey(Integer id);
19
+
20
+    int updateByPrimaryKeySelective(TaUser record);
21
+
22
+    int updateByPrimaryKey(TaUser record);
23
+
24
+    /**
25
+     * 根据loginName和loginPassword 查询用户
26
+     * @param map
27
+     * @return 用户
28
+     */
29
+    TaUser selectByLoginNameAndByLoginPassword(Map<String, Object> map);
30
+
31
+    /**
32
+     * 根据loginName 查询用户
33
+     * @param map
34
+     * @return 用户
35
+     */
36
+    TaUser selectByLoginName(Map<String, Object> map);
37
+
38
+    /**
39
+     * 更新当前用户电话
40
+     * @param record
41
+     * @return
42
+     */
43
+    TaUser updateLongName(TaUser record);
44
+
45
+    /**
46
+     * 查询房屋成员列表
47
+     * @param parentId
48
+     * @return
49
+     */
50
+    List<TaUser> selectUserListByParentId(Integer parentId);
51
+
52
+    /**
53
+     * 判断当前用户的关联关系
54
+     * @param userId
55
+     * @param otherUserID
56
+     * @return
57
+     */
58
+    TaUser selectTaFaceParentId(@Param("id") Integer userId, @Param("otherUserID") Integer otherUserID);
59
+
60
+    /**
61
+     * 查询此电话在小区是否存在
62
+     * @param communityId
63
+     * @param phone
64
+     * @return
65
+     */
66
+    TaUser getByLoginName(@Param("id") Integer communityId, @Param("id") String phone);
67
+
68
+    /**
69
+     * 查询 业主/家属/租客 的总数
70
+     *
71
+     *  1 业主  2 租客  3 家属
72
+     * @param roleId 角色ID(业主/家属/租客)
73
+     * @return
74
+     */
75
+    Integer getByUserTypeCount(Integer roleId);
76
+
77
+    /**
78
+     * 获取 家属 总数(包含业主)
79
+     *
80
+     *  1 业主  2 租客  3 家属
81
+     *
82
+     * @return
83
+     */
84
+    Integer getOwnerCount();
85
+}

+ 240
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/model/TaUser.java Zobrazit soubor

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

+ 15
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/ITaUserService.java Zobrazit soubor

@@ -0,0 +1,15 @@
1
+package com.community.huiju.service;
2
+
3
+import com.community.commom.mode.ResponseBean;
4
+
5
+public interface ITaUserService {
6
+
7
+    /**
8
+     * 查询 业主/家属/租客 的总数
9
+     *
10
+     * @param
11
+     * @return
12
+     */
13
+    ResponseBean getByUserTypeCount();
14
+
15
+}

+ 50
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/impl/TaUserServiceImpl.java Zobrazit soubor

@@ -0,0 +1,50 @@
1
+package com.community.huiju.service.impl;
2
+
3
+import com.community.commom.mode.ResponseBean;
4
+import com.community.huiju.dao.TaUserMapper;
5
+import com.community.huiju.service.ITaUserService;
6
+import com.google.common.collect.Lists;
7
+import com.google.common.collect.Maps;
8
+import org.springframework.beans.factory.annotation.Autowired;
9
+import org.springframework.stereotype.Service;
10
+
11
+import java.util.List;
12
+import java.util.Map;
13
+
14
+/**
15
+ * app 端用户业务类
16
+ * @author weiximei
17
+ */
18
+@Service("iTaUserService")
19
+public class TaUserServiceImpl implements ITaUserService {
20
+
21
+    @Autowired
22
+    private TaUserMapper taUserMapper;
23
+
24
+    @Override
25
+    public ResponseBean getByUserTypeCount() {
26
+        ResponseBean responseBean = new ResponseBean();
27
+
28
+        Map<String,Object> ownerMap = Maps.newHashMap();
29
+        Integer ownerCount = taUserMapper.getByUserTypeCount(1);
30
+        ownerMap.put("message","业主总数");
31
+        ownerMap.put("count",ownerCount);
32
+        Map<String,Object> tenantMap = Maps.newHashMap();
33
+        Integer tenantCount = taUserMapper.getByUserTypeCount(2);
34
+        tenantMap.put("message","租客总数");
35
+        tenantMap.put("count",tenantCount);
36
+        Map<String,Object> relationMap = Maps.newHashMap();
37
+        Integer relationCount = taUserMapper.getByUserTypeCount(3);
38
+        relationMap.put("message","家属总数");
39
+        relationMap.put("count",relationCount);
40
+
41
+        List<Map<String,Object>> mapList = Lists.newArrayList();
42
+        mapList.add(ownerMap);
43
+        mapList.add(tenantMap);
44
+        mapList.add(relationMap);
45
+
46
+        responseBean.addSuccess(mapList);
47
+        return responseBean;
48
+    }
49
+
50
+}

+ 349
- 0
CODE/smart-community/operate-api/src/main/resources/mapper/TaUserMapper.xml Zobrazit soubor

@@ -0,0 +1,349 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
3
+<mapper namespace="com.community.huiju.dao.TaUserMapper" >
4
+  <resultMap id="BaseResultMap" type="com.community.huiju.model.TaUser" >
5
+    <id column="id" property="id" jdbcType="INTEGER" />
6
+    <result column="community_id" property="communityId" jdbcType="INTEGER" />
7
+    <result column="building_owner_info_id" property="buildingOwnerInfoId" jdbcType="INTEGER" />
8
+    <result column="head_portrait" property="headPortrait" jdbcType="VARCHAR" />
9
+    <result column="user_name" property="userName" jdbcType="VARCHAR" />
10
+    <result column="login_name" property="loginName" jdbcType="VARCHAR" />
11
+    <result column="login_password" property="loginPassword" jdbcType="VARCHAR" />
12
+    <result column="email" property="email" jdbcType="VARCHAR" />
13
+    <result column="gender" property="gender" jdbcType="CHAR" />
14
+    <result column="status" property="status" jdbcType="CHAR" />
15
+    <result column="remark" property="remark" jdbcType="VARCHAR" />
16
+    <result column="parent_id" property="parentId" jdbcType="INTEGER" />
17
+    <result column="accept_agreement_status" property="acceptAgreementStatus" jdbcType="CHAR" />
18
+    <result column="verify_status" property="verifyStatus" jdbcType="CHAR" />
19
+    <result column="create_user" property="createUser" jdbcType="INTEGER" />
20
+    <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
21
+    <result column="update_user" property="updateUser" jdbcType="INTEGER" />
22
+    <result column="update_date" property="updateDate" jdbcType="TIMESTAMP" />
23
+    <result column="hk_user_id" property="hkUserId" jdbcType="INTEGER" />
24
+    <result column="hk_card_no" property="hkCardNo" jdbcType="VARCHAR" />
25
+    <result column="face_status" property="faceStatus" jdbcType="CHAR" />
26
+  </resultMap>
27
+  <sql id="Base_Column_List" >
28
+    id, community_id, building_owner_info_id, head_portrait, user_name, login_name, login_password,
29
+    email, gender, status, remark, parent_id, accept_agreement_status, verify_status,
30
+    create_user, create_date, update_user, update_date, hk_user_id, hk_card_no, face_status
31
+  </sql>
32
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
33
+    select
34
+    <include refid="Base_Column_List" />
35
+    from ta_user
36
+    where id = #{id,jdbcType=INTEGER}
37
+  </select>
38
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
39
+    delete from ta_user
40
+    where id = #{id,jdbcType=INTEGER}
41
+  </delete>
42
+  <insert id="insert" parameterType="com.community.huiju.model.TaUser" useGeneratedKeys="true" keyProperty="id" >
43
+    insert into ta_user (id, community_id, building_owner_info_id,
44
+      head_portrait, user_name, login_name,
45
+      login_password, email, gender,
46
+      status, remark, parent_id,
47
+      accept_agreement_status, verify_status, create_user,
48
+      create_date, update_user, update_date,
49
+      hk_user_id, hk_card_no, face_status
50
+      )
51
+    values (#{id,jdbcType=INTEGER}, #{communityId,jdbcType=INTEGER}, #{buildingOwnerInfoId,jdbcType=INTEGER},
52
+      #{headPortrait,jdbcType=VARCHAR}, #{userName,jdbcType=VARCHAR}, #{loginName,jdbcType=VARCHAR},
53
+      #{loginPassword,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{gender,jdbcType=CHAR},
54
+      #{status,jdbcType=CHAR}, #{remark,jdbcType=VARCHAR}, #{parentId,jdbcType=INTEGER},
55
+      #{acceptAgreementStatus,jdbcType=CHAR}, #{verifyStatus,jdbcType=CHAR}, #{createUser,jdbcType=INTEGER},
56
+      #{createDate,jdbcType=TIMESTAMP}, #{updateUser,jdbcType=INTEGER}, #{updateDate,jdbcType=TIMESTAMP},
57
+      #{hkUserId,jdbcType=INTEGER}, #{hkCardNo,jdbcType=VARCHAR}, #{faceStatus,jdbcType=CHAR}
58
+      )
59
+  </insert>
60
+  <insert id="insertSelective" parameterType="com.community.huiju.model.TaUser" useGeneratedKeys="true" keyProperty="id" >
61
+    insert into ta_user
62
+    <trim prefix="(" suffix=")" suffixOverrides="," >
63
+      <if test="id != null" >
64
+        id,
65
+      </if>
66
+      <if test="communityId != null" >
67
+        community_id,
68
+      </if>
69
+      <if test="buildingOwnerInfoId != null" >
70
+        building_owner_info_id,
71
+      </if>
72
+      <if test="headPortrait != null" >
73
+        head_portrait,
74
+      </if>
75
+      <if test="userName != null" >
76
+        user_name,
77
+      </if>
78
+      <if test="loginName != null" >
79
+        login_name,
80
+      </if>
81
+      <if test="loginPassword != null" >
82
+        login_password,
83
+      </if>
84
+      <if test="email != null" >
85
+        email,
86
+      </if>
87
+      <if test="gender != null" >
88
+        gender,
89
+      </if>
90
+      <if test="status != null" >
91
+        status,
92
+      </if>
93
+      <if test="remark != null" >
94
+        remark,
95
+      </if>
96
+      <if test="parentId != null" >
97
+        parent_id,
98
+      </if>
99
+      <if test="acceptAgreementStatus != null" >
100
+        accept_agreement_status,
101
+      </if>
102
+      <if test="verifyStatus != null" >
103
+        verify_status,
104
+      </if>
105
+      <if test="createUser != null" >
106
+        create_user,
107
+      </if>
108
+      <if test="createDate != null" >
109
+        create_date,
110
+      </if>
111
+      <if test="updateUser != null" >
112
+        update_user,
113
+      </if>
114
+      <if test="updateDate != null" >
115
+        update_date,
116
+      </if>
117
+      <if test="hkUserId != null" >
118
+        hk_user_id,
119
+      </if>
120
+      <if test="hkCardNo != null" >
121
+        hk_card_no,
122
+      </if>
123
+      <if test="faceStatus != null" >
124
+        face_status,
125
+      </if>
126
+    </trim>
127
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
128
+      <if test="id != null" >
129
+        #{id,jdbcType=INTEGER},
130
+      </if>
131
+      <if test="communityId != null" >
132
+        #{communityId,jdbcType=INTEGER},
133
+      </if>
134
+      <if test="buildingOwnerInfoId != null" >
135
+        #{buildingOwnerInfoId,jdbcType=INTEGER},
136
+      </if>
137
+      <if test="headPortrait != null" >
138
+        #{headPortrait,jdbcType=VARCHAR},
139
+      </if>
140
+      <if test="userName != null" >
141
+        #{userName,jdbcType=VARCHAR},
142
+      </if>
143
+      <if test="loginName != null" >
144
+        #{loginName,jdbcType=VARCHAR},
145
+      </if>
146
+      <if test="loginPassword != null" >
147
+        #{loginPassword,jdbcType=VARCHAR},
148
+      </if>
149
+      <if test="email != null" >
150
+        #{email,jdbcType=VARCHAR},
151
+      </if>
152
+      <if test="gender != null" >
153
+        #{gender,jdbcType=CHAR},
154
+      </if>
155
+      <if test="status != null" >
156
+        #{status,jdbcType=CHAR},
157
+      </if>
158
+      <if test="remark != null" >
159
+        #{remark,jdbcType=VARCHAR},
160
+      </if>
161
+      <if test="parentId != null" >
162
+        #{parentId,jdbcType=INTEGER},
163
+      </if>
164
+      <if test="acceptAgreementStatus != null" >
165
+        #{acceptAgreementStatus,jdbcType=CHAR},
166
+      </if>
167
+      <if test="verifyStatus != null" >
168
+        #{verifyStatus,jdbcType=CHAR},
169
+      </if>
170
+      <if test="createUser != null" >
171
+        #{createUser,jdbcType=INTEGER},
172
+      </if>
173
+      <if test="createDate != null" >
174
+        #{createDate,jdbcType=TIMESTAMP},
175
+      </if>
176
+      <if test="updateUser != null" >
177
+        #{updateUser,jdbcType=INTEGER},
178
+      </if>
179
+      <if test="updateDate != null" >
180
+        #{updateDate,jdbcType=TIMESTAMP},
181
+      </if>
182
+      <if test="hkUserId != null" >
183
+        #{hkUserId,jdbcType=INTEGER},
184
+      </if>
185
+      <if test="hkCardNo != null" >
186
+        #{hkCardNo,jdbcType=VARCHAR},
187
+      </if>
188
+      <if test="faceStatus != null" >
189
+        #{faceStatus,jdbcType=CHAR},
190
+      </if>
191
+    </trim>
192
+  </insert>
193
+  <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.TaUser" >
194
+    update ta_user
195
+    <set >
196
+      <if test="communityId != null" >
197
+        community_id = #{communityId,jdbcType=INTEGER},
198
+      </if>
199
+      <if test="buildingOwnerInfoId != null" >
200
+        building_owner_info_id = #{buildingOwnerInfoId,jdbcType=INTEGER},
201
+      </if>
202
+      <if test="headPortrait != null" >
203
+        head_portrait = #{headPortrait,jdbcType=VARCHAR},
204
+      </if>
205
+      <if test="userName != null" >
206
+        user_name = #{userName,jdbcType=VARCHAR},
207
+      </if>
208
+      <if test="loginName != null" >
209
+        login_name = #{loginName,jdbcType=VARCHAR},
210
+      </if>
211
+      <if test="loginPassword != null" >
212
+        login_password = #{loginPassword,jdbcType=VARCHAR},
213
+      </if>
214
+      <if test="email != null" >
215
+        email = #{email,jdbcType=VARCHAR},
216
+      </if>
217
+      <if test="gender != null" >
218
+        gender = #{gender,jdbcType=CHAR},
219
+      </if>
220
+      <if test="status != null" >
221
+        status = #{status,jdbcType=CHAR},
222
+      </if>
223
+      <if test="remark != null" >
224
+        remark = #{remark,jdbcType=VARCHAR},
225
+      </if>
226
+      <if test="parentId != null" >
227
+        parent_id = #{parentId,jdbcType=INTEGER},
228
+      </if>
229
+      <if test="acceptAgreementStatus != null" >
230
+        accept_agreement_status = #{acceptAgreementStatus,jdbcType=CHAR},
231
+      </if>
232
+      <if test="verifyStatus != null" >
233
+        verify_status = #{verifyStatus,jdbcType=CHAR},
234
+      </if>
235
+      <if test="createUser != null" >
236
+        create_user = #{createUser,jdbcType=INTEGER},
237
+      </if>
238
+      <if test="createDate != null" >
239
+        create_date = #{createDate,jdbcType=TIMESTAMP},
240
+      </if>
241
+      <if test="updateUser != null" >
242
+        update_user = #{updateUser,jdbcType=INTEGER},
243
+      </if>
244
+      <if test="updateDate != null" >
245
+        update_date = #{updateDate,jdbcType=TIMESTAMP},
246
+      </if>
247
+      <if test="hkUserId != null" >
248
+        hk_user_id = #{hkUserId,jdbcType=INTEGER},
249
+      </if>
250
+      <if test="hkCardNo != null" >
251
+        hk_card_no = #{hkCardNo,jdbcType=VARCHAR},
252
+      </if>
253
+      <if test="faceStatus != null" >
254
+        face_status = #{faceStatus,jdbcType=CHAR},
255
+      </if>
256
+    </set>
257
+    where id = #{id,jdbcType=INTEGER}
258
+  </update>
259
+  <update id="updateByPrimaryKey" parameterType="com.community.huiju.model.TaUser" >
260
+    update ta_user
261
+    set community_id = #{communityId,jdbcType=INTEGER},
262
+      building_owner_info_id = #{buildingOwnerInfoId,jdbcType=INTEGER},
263
+      head_portrait = #{headPortrait,jdbcType=VARCHAR},
264
+      user_name = #{userName,jdbcType=VARCHAR},
265
+      login_name = #{loginName,jdbcType=VARCHAR},
266
+      login_password = #{loginPassword,jdbcType=VARCHAR},
267
+      email = #{email,jdbcType=VARCHAR},
268
+      gender = #{gender,jdbcType=CHAR},
269
+      status = #{status,jdbcType=CHAR},
270
+      remark = #{remark,jdbcType=VARCHAR},
271
+      parent_id = #{parentId,jdbcType=INTEGER},
272
+      accept_agreement_status = #{acceptAgreementStatus,jdbcType=CHAR},
273
+      verify_status = #{verifyStatus,jdbcType=CHAR},
274
+      create_user = #{createUser,jdbcType=INTEGER},
275
+      create_date = #{createDate,jdbcType=TIMESTAMP},
276
+      update_user = #{updateUser,jdbcType=INTEGER},
277
+      update_date = #{updateDate,jdbcType=TIMESTAMP},
278
+      hk_user_id = #{hkUserId,jdbcType=INTEGER},
279
+      hk_card_no = #{hkCardNo,jdbcType=VARCHAR},
280
+      face_status = #{faceStatus,jdbcType=CHAR}
281
+    where id = #{id,jdbcType=INTEGER}
282
+  </update>
283
+
284
+  <select id="selectByLoginNameAndByLoginPassword" parameterType="map" resultMap="BaseResultMap" >
285
+    select
286
+    <include refid="Base_Column_List" />
287
+    from ta_user
288
+    where login_name=#{loginName,jdbcType=VARCHAR} and login_password = #{loginPassword,jdbcType=VARCHAR}
289
+  </select>
290
+
291
+  <select id="selectByLoginName" parameterType="map" resultMap="BaseResultMap" >
292
+    select
293
+    <include refid="Base_Column_List" />
294
+    from ta_user
295
+    where login_name=#{loginName,jdbcType=VARCHAR}
296
+  </select>
297
+
298
+  <select id="updateLongName" parameterType="com.community.huiju.model.TaUser" resultMap="BaseResultMap">
299
+    update ta_user
300
+    set
301
+    login_name = #{loginName,jdbcType=VARCHAR}
302
+    where id = #{id,jdbcType=INTEGER}
303
+  </select>
304
+
305
+  <select id="selectUserListByParentId" parameterType="java.lang.Integer" resultMap="BaseResultMap" >
306
+    select
307
+    <include refid="Base_Column_List" />
308
+    from ta_user
309
+    where parent_id = #{parentId}
310
+  </select>
311
+
312
+  <select id="selectTaFaceParentId" parameterType="java.lang.Integer" resultMap="BaseResultMap" >
313
+    select
314
+      <include refid="Base_Column_List" />
315
+    from ta_user
316
+    where 1=1
317
+    <if test="otherUserID != null" >
318
+     and id = #{otherUserID,jdbcType=INTEGER}
319
+    </if>
320
+    <if test="id != null" >
321
+     and parent_id = #{id}
322
+    </if>
323
+    limit 1
324
+  </select>
325
+
326
+  <select id="getByLoginName" parameterType="java.lang.Integer" resultMap="BaseResultMap" >
327
+    select
328
+    <include refid="Base_Column_List" />
329
+    from ta_user
330
+    where community_id = #{communityId,jdbcType=INTEGER}
331
+    <if test="otherUserID != null" >
332
+      and login_name = #{phone}
333
+    </if>
334
+
335
+  </select>
336
+
337
+  <select id="getByUserTypeCount" parameterType="java.lang.Integer" resultType="java.lang.Integer">
338
+    SELECT COUNT(*)
339
+    FROM ta_user tu
340
+    INNER JOIN ta_sys_user_role tsur on tu.id = tsur.user_id where tsur.role_id = #{roleId,jdbcType=INTEGER}
341
+  </select>
342
+
343
+  <select id="getOwnerCount" parameterType="java.lang.Integer" resultType="java.lang.Integer">
344
+    SELECT COUNT(*)
345
+    FROM ta_user tu
346
+    INNER JOIN ta_sys_user_role tsur on tu.id = tsur.user_id where tsur.role_id != 2
347
+  </select>
348
+
349
+</mapper>