dingxin 6 jaren geleden
bovenliggende
commit
15e64b5786
22 gewijzigde bestanden met toevoegingen van 260 en 117 verwijderingen
  1. 3
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/common/code/impl/PhoneCodeImpl.java
  2. 11
    3
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/CodeController.java
  3. 4
    2
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/MessageController.java
  4. 2
    25
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/SocialController.java
  5. 25
    2
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/TicketController.java
  6. 1
    1
      CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpMessageMapper.java
  7. 16
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/ITicketService.java
  8. 1
    1
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/MessageServiceI.java
  9. 0
    10
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/SocialServiceI.java
  10. 1
    1
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/BannerServiceImpl.java
  11. 3
    2
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/MessageServiceImpl.java
  12. 16
    47
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/SocialServiceImpl.java
  13. 31
    8
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TaUserServiceImpl.java
  14. 34
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TicketServiceImpl.java
  15. 2
    1
      CODE/smart-community/app-api/src/main/resources/mapper/TpActivityMapper.xml
  16. 2
    0
      CODE/smart-community/app-api/src/main/resources/mapper/TpMessageMapper.xml
  17. 7
    4
      CODE/smart-community/community-common/src/main/java/com/community/commom/constant/Constant.java
  18. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/constant/Constant.class
  19. 3
    2
      CODE/smart-community/zuul/src/main/java/com/community/huiju/security/RestAuthenticationEntryPoint.java
  20. 3
    1
      CODE/smart-community/zuul/src/main/java/com/community/huiju/security/RestPreAuthenticatedProcessingFilter.java
  21. 7
    7
      CODE/smart-community/zuul/src/main/java/com/community/huiju/security/WisdomSecurityConfig.java
  22. 88
    0
      CODE/smart-community/zuul/src/main/java/com/community/huiju/security/dome/TokenAuthrentication.java

+ 3
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/common/code/impl/PhoneCodeImpl.java Bestand weergeven

@@ -1,7 +1,9 @@
1 1
 package com.community.huiju.common.code.impl;
2 2
 
3 3
 import com.community.commom.constant.Constant;
4
+import com.community.commom.utils.AccountValidatorUtil;
4 5
 import com.community.huiju.common.code.ICode;
6
+import com.community.huiju.common.code.cache.AppkeyCache;
5 7
 import lombok.extern.slf4j.Slf4j;
6 8
 import okhttp3.*;
7 9
 import org.springframework.beans.factory.annotation.Autowired;
@@ -36,6 +38,7 @@ public class PhoneCodeImpl implements ICode {
36 38
     @Override
37 39
     public boolean sendCode(String phone, String code) {
38 40
         boolean bool = false;
41
+
39 42
         try {
40 43
             String result = null;
41 44
             OkHttpClient client = getClient();

+ 11
- 3
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/CodeController.java Bestand weergeven

@@ -2,6 +2,7 @@ package com.community.huiju.controller;
2 2
 
3 3
 import com.community.commom.constant.Constant;
4 4
 import com.community.commom.mode.ResponseBean;
5
+import com.community.commom.utils.AccountValidatorUtil;
5 6
 import com.community.huiju.common.code.ICode;
6 7
 import com.community.huiju.common.code.cache.AppkeyCache;
7 8
 import io.swagger.annotations.Api;
@@ -39,15 +40,22 @@ public class CodeController {
39 40
     @RequestMapping(value = "/code/sendCode",method = RequestMethod.POST)
40 41
     public ResponseBean sendCode(@RequestParam String phone, HttpSession session) {
41 42
         ResponseBean response = new ResponseBean();
43
+
44
+        log.info("{} 手机号校验结果: {}",phone, AccountValidatorUtil.isPhone(phone));
45
+        if (!AccountValidatorUtil.isPhone(phone)){
46
+            response.addError("请输入正取的手机号!");
47
+            return response;
48
+        }
49
+
42 50
         int code = (int) ((Math.random()*9+1)*1000);
43
-        boolean result = iCode.sendCode(phone,String.valueOf(code));
44
-        //boolean result = true;
51
+        //boolean result = iCode.sendCode(phone,String.valueOf(code));
52
+        boolean result = true;
45 53
         if (result) {
46 54
             log.info("{} 验证码: {}",phone,code);
47 55
             // 设置缓存
48 56
             AppkeyCache.setCache(phone,String.valueOf(code));
49 57
             //session.setAttribute(Constant.SESSION_PHONE_CODE,String.valueOf(code));
50
-            response.addSuccess("发送成功!");
58
+            response.addSuccess("发送成功!"+code);
51 59
         } else {
52 60
             response.addError("发送失败!");
53 61
         }

+ 4
- 2
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/MessageController.java Bestand weergeven

@@ -86,9 +86,11 @@ public class MessageController {
86 86
 	@ApiImplicitParams({ @ApiImplicitParam(paramType = "path", dataType = "String", name = "communityId", value = "小区Id"),
87 87
 			@ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")})
88 88
 	@RequestMapping(value = "/readStatus/{communityId}",method = RequestMethod.POST)
89
-	public ResponseBean allMessageRead(@PathVariable("communityId") Integer communityId){
89
+	public ResponseBean allMessageRead(@PathVariable("communityId") Integer communityId, HttpSession session){
90
+		UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
91
+		Integer userId = userElement.getId();
90 92
 		ResponseBean responseBean = new ResponseBean();
91
-		messageService.updateMessageReadStatus(communityId);
93
+		messageService.updateMessageReadStatus(communityId, userId);
92 94
 		return responseBean;
93 95
 	}
94 96
 }

+ 2
- 25
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/SocialController.java Bestand weergeven

@@ -47,7 +47,7 @@ public class SocialController {
47 47
         return responseBean;
48 48
     }
49 49
 
50
-    @RequestMapping(value = "/sign/{communityId}", method = RequestMethod.GET)
50
+    @RequestMapping(value = "/sign/{communityId}", method = RequestMethod.POST)
51 51
     @ApiOperation(value = "活动报名接口", notes = "活动报名接口")
52 52
     @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
53 53
             @ApiImplicitParam(paramType = "query", dataType = "integer", name = "activityId", value = "活动Id"),
@@ -147,7 +147,7 @@ public class SocialController {
147 147
             @ApiImplicitParam(paramType = "query", dataType = "String", name = "type", value = "帖子类型"),
148 148
             @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageNum", value = "分页第几页"),
149 149
             @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageSize", value = "分页每页长度")})
150
-    @RequestMapping(value = "/getAllTransaction/{communityId}", method = RequestMethod.GET)
150
+    @RequestMapping(value = "/getTransactions /{communityId}", method = RequestMethod.GET)
151 151
     public ResponseBean getAllPosts(@PathVariable("communityId") Integer communityId, @RequestParam("type") String type,
152 152
                                     @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
153 153
                                     @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize) {
@@ -157,29 +157,6 @@ public class SocialController {
157 157
         return responseBean;
158 158
     }
159 159
 
160
-    @ApiOperation(value = "报修进度终止", notes = "报修进度终止")
161
-    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
162
-            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "ticketId", value = "帖子Id"),
163
-            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")})
164
-    @RequestMapping(value = "/stopTicket/{communityId}", method = RequestMethod.GET)
165
-    public ResponseBean stopTicket(@PathVariable("communityId") Integer communityId, @RequestParam("ticketId") Integer ticketId, HttpSession session) {
166
-        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
167
-        Integer userId = userElement.getId();
168
-        ResponseBean responseBean = socialServiceI.stopTpTicketRecord(communityId, ticketId, userId);
169
-        return responseBean;
170
-    }
171
-
172
-    @ApiOperation(value = "修改报修内容", notes = "修改报修内容")
173
-    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "ticketId", value = "工单Id"),
174
-            @ApiImplicitParam(name = "tpTicket", value = "报修", required = true, dataType = "TpTicket"),
175
-            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "type", value = "工单类型")})
176
-    @RequestMapping(value = "/updateTicket/{ticketId}", method = RequestMethod.POST)
177
-    public ResponseBean updateTicketContent(@PathVariable("ticketId") Integer ticketId, @RequestBody TpTicket tpTicket, @RequestParam("type") String type) {
178
-        ResponseBean responseBean = new ResponseBean();
179
-        socialServiceI.updateTicketContent(ticketId, tpTicket, type);
180
-        return responseBean;
181
-    }
182
-
183 160
     @ApiOperation(value = "添加二手租赁帖子", notes = "添加二手租赁帖子")
184 161
     @ApiImplicitParams({
185 162
             @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value =

+ 25
- 2
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/TicketController.java Bestand weergeven

@@ -104,7 +104,8 @@ public class TicketController {
104 104
 
105 105
     @ApiOperation(value = "回复 报修/投诉/联系单 追问接口", notes = "回复 报修/投诉/联系单 追问接口")
106 106
     @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
107
-            @ApiImplicitParam(name = "tpTicketRecordComment", value = "回复记录参数", paramType = "body")})
107
+            @ApiImplicitParam(name = "tpTicketRecordComment", value = "回复记录参数", paramType = "body"),
108
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")})
108 109
     @RequestMapping(value = "/ticket/reply/{communityId}", method = RequestMethod.POST)
109 110
     public ResponseBean updateTicketsReply(@PathVariable(value = "communityId") Integer communityId, @RequestBody TpTicketRecordComment tpTicketRecordComment, HttpSession session){
110 111
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
@@ -122,7 +123,6 @@ public class TicketController {
122 123
 
123 124
     @ApiOperation(value = "添加报修", notes = "添加报修")
124 125
     @ApiImplicitParams({
125
-
126 126
             @ApiImplicitParam(paramType = "query",dataType = "String",name = "ticketContent",value = "工单内容"),
127 127
             @ApiImplicitParam(paramType = "query",dataType = "String",name = "ticketTitle",value = "工单标题"),
128 128
             @ApiImplicitParam(paramType = "query",dataType = "String",name = "repairType",value = "报修房屋类型"),
@@ -146,6 +146,29 @@ public class TicketController {
146 146
                 responseBean.addSuccess(agreement);
147 147
         return responseBean;
148 148
     }
149
+
150
+    @ApiOperation(value = "修改报修内容", notes = "修改报修内容")
151
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "ticketId", value = "工单Id"),
152
+            @ApiImplicitParam(name = "tpTicket", value = "报修", required = true, dataType = "TpTicket"),
153
+            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "type", value = "工单类型")})
154
+    @RequestMapping(value = "/updateTicket/{ticketId}", method = RequestMethod.POST)
155
+    public ResponseBean updateTicketContent(@PathVariable("ticketId") Integer ticketId, @RequestBody TpTicket tpTicket, @RequestParam("type") String type) {
156
+        ResponseBean responseBean = new ResponseBean();
157
+        iTicketService.updateTicketContent(ticketId, tpTicket, type);
158
+        return responseBean;
159
+    }
160
+
161
+    @ApiOperation(value = "报修进度终止", notes = "报修进度终止")
162
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
163
+            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "ticketId", value = "帖子Id"),
164
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")})
165
+    @RequestMapping(value = "/stopTicket/{communityId}", method = RequestMethod.GET)
166
+    public ResponseBean stopTicket(@PathVariable("communityId") Integer communityId, @RequestParam("ticketId") Integer ticketId, HttpSession session) {
167
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
168
+        Integer userId = userElement.getId();
169
+        ResponseBean responseBean = iTicketService.stopTpTicketRecord(communityId, ticketId, userId);
170
+        return responseBean;
171
+    }
149 172
 }
150 173
 
151 174
 

+ 1
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpMessageMapper.java Bestand weergeven

@@ -25,5 +25,5 @@ public interface TpMessageMapper {
25 25
     
26 26
     List<TpMessage> getMessages(@Param(value = "userId") Integer userId,@Param(value = "communityId") Integer communityId, @Param(value = "modelType") Integer modelType);
27 27
 
28
-    void updateReadStatus(Integer communityId);
28
+    void updateReadStatus(@Param(value = "communityId")Integer communityId, @Param(value = "userId")Integer userId);
29 29
 }

+ 16
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/ITicketService.java Bestand weergeven

@@ -54,4 +54,20 @@ public interface ITicketService {
54 54
 	 * @return
55 55
 	 */
56 56
 	Integer updateTicketsReply(TpTicketRecordComment tpTicketRecordComment, Integer userId);
57
+
58
+	/**
59
+	 * 修改报修内容
60
+	 * @param ticketId
61
+	 * @param tpTicket
62
+	 * @param type
63
+	 */
64
+	void updateTicketContent(Integer ticketId, TpTicket tpTicket, String type);
65
+
66
+	/**
67
+	 * 终止报修
68
+	 * @param communityId
69
+	 * @param ticketId
70
+	 * @return
71
+	 */
72
+	ResponseBean stopTpTicketRecord(Integer communityId, Integer ticketId, Integer userId);
57 73
 }

+ 1
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/MessageServiceI.java Bestand weergeven

@@ -26,5 +26,5 @@ public interface MessageServiceI {
26 26
 	/**
27 27
 	 * 全部已读
28 28
 	 */
29
-	void updateMessageReadStatus(Integer communityId);
29
+	void updateMessageReadStatus(Integer communityId, Integer userId);
30 30
 }

+ 0
- 10
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/SocialServiceI.java Bestand weergeven

@@ -66,14 +66,6 @@ public interface SocialServiceI {
66 66
 	 */
67 67
 	List<TpTransaction> findAllTransaction(Integer communityId, String type, Integer pageNum, Integer paeSize);
68 68
 
69
-	/**
70
-	 * 终止报修
71
-	 * @param communityId
72
-	 * @param ticketId
73
-	 * @return
74
-	 */
75
-	ResponseBean stopTpTicketRecord(Integer communityId, Integer ticketId, Integer userId);
76
-
77 69
 	/**
78 70
 	 * 添加二手租赁帖子
79 71
 	 */
@@ -91,8 +83,6 @@ public interface SocialServiceI {
91 83
 	 */
92 84
 	ResponseBean updateTransaction(String paramets,Integer userId);
93 85
 
94
-	void updateTicketContent(Integer ticketId, TpTicket tpTicket, String type);
95
-
96 86
 	/**
97 87
 	 * 评价工单以及评分
98 88
 	 * @param communityId

+ 1
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/BannerServiceImpl.java Bestand weergeven

@@ -34,7 +34,7 @@ public class BannerServiceImpl implements BannerServiceI {
34 34
     @Override
35 35
     public List<ToBanner> viewAllBannerImg() {
36 36
         //查询轮播图数量
37
-        Integer bannerNum = tpCarouselSettingMapper.selectCarouselNum(Constant.ANNOUNCEMENT);
37
+        Integer bannerNum = tpCarouselSettingMapper.selectCarouselNum(Constant.BANNER);
38 38
 
39 39
         String nowTime = DateUtils.getDate("yyyy-MM-dd");
40 40
         return toBannerMapper.selectAllByNum(nowTime, bannerNum);

+ 3
- 2
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/MessageServiceImpl.java Bestand weergeven

@@ -4,6 +4,7 @@ import com.community.huiju.dao.TpMessageMapper;
4 4
 import com.community.huiju.model.TpMessage;
5 5
 import com.community.huiju.service.MessageServiceI;
6 6
 import com.github.pagehelper.PageHelper;
7
+import io.swagger.models.auth.In;
7 8
 import org.springframework.beans.factory.annotation.Autowired;
8 9
 import org.springframework.stereotype.Service;
9 10
 
@@ -51,7 +52,7 @@ public class MessageServiceImpl implements MessageServiceI {
51 52
 	 * 消息全部已读
52 53
 	 */
53 54
 	@Override
54
-	public void updateMessageReadStatus(Integer communityId) {
55
-		tpMessageMapper.updateReadStatus(communityId);
55
+	public void updateMessageReadStatus(Integer communityId, Integer userId) {
56
+		tpMessageMapper.updateReadStatus(communityId, userId);
56 57
 	}
57 58
 }

+ 16
- 47
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/SocialServiceImpl.java Bestand weergeven

@@ -188,23 +188,25 @@ public class SocialServiceImpl implements SocialServiceI {
188 188
         if (Constant.INVALID.equals(taUser.getStatus())
189 189
             && Constant.OWNER.equals(sysRole.getRoleName())){
190 190
 
191
-            return insertActivitySignUp(tpActivity, communityId, userId);
191
+            responseBean.addError("9996", "您的身份已停用,请联系物业");
192
+            return responseBean;
192 193
         }
193 194
 
194 195
         //身份为家属租客,状态为已停用
195 196
         if (Constant.INVALID.equals(taUser.getStatus())
196
-            && (Constant.FAMILYMEMBER.equals(sysRole.getRoleName())) || Constant.TENANT.equals(sysRole.getRoleName())){
197
+            && (Constant.RELATION.equals(sysRole.getRoleName())) || Constant.TENANT.equals(sysRole.getRoleName())){
197 198
 
198
-            return insertActivitySignUp(tpActivity, communityId, userId);
199
+            responseBean.addError("9996", "您的身份已停用,请联系物业");
200
+            return responseBean;
199 201
         }
200 202
 
201 203
         if (Constant.EFFECTIVE.equals(taUser.getStatus())
202
-                && (Constant.FAMILYMEMBER.equals(sysRole.getRoleName()))
204
+                && (Constant.RELATION.equals(sysRole.getRoleName()))
203 205
                 || Constant.TENANT.equals(sysRole.getRoleName())
204 206
                 || Constant.OWNER.equals(sysRole.getRoleName())){
205 207
             return insertActivitySignUp(tpActivity, communityId, userId);
206 208
         }
207
-        responseBean.addError("9999", "服务器异常");
209
+        responseBean.addError("9995", "无法确认您的身份,请联系物业");
208 210
         return responseBean;
209 211
     }
210 212
 
@@ -214,41 +216,11 @@ public class SocialServiceImpl implements SocialServiceI {
214 216
         return tpTransactionMapper.findAllTransaction(communityId, type);
215 217
     }
216 218
 
217
-    @Transactional
218
-    @Override
219
-    public ResponseBean stopTpTicketRecord(Integer communityId, Integer ticketId, Integer userId) {
220
-        ResponseBean responseBean = new ResponseBean();
221
-        try{
222
-            TpTicket tpTicket = new TpTicket();
223
-            tpTicket.setStatus("6");
224
-            tpTicket.setId(ticketId);
225
-            tpTicketMapper.updateByPrimaryKeySelective(tpTicket);
226
-
227
-            TpTicketRecord tpTicketRecord = new TpTicketRecord();
228
-            tpTicketRecord.setStatus("6");
229
-            tpTicketRecord.setTicketId(ticketId);
230
-            tpTicketRecord.setCommunityId(communityId);
231
-            //TODO
232
-            tpTicketRecord.setCreateUser(userId);
233
-            tpTicketRecord.setCreateDate(new Date());
234
-            tpTicketRecordMapper.insertSelective(tpTicketRecord);
235
-            return responseBean;
236
-        }catch(Exception e){
237
-            e.printStackTrace();
238
-            responseBean.addError("服务器异常");
239
-            return responseBean;
240
-        }
241
-    }
242 219
 
243
-    @Override
244
-    public void updateTicketContent(Integer ticketId, TpTicket tpTicket, String type) {
245
-        tpTicket.setId(ticketId);
246
-        tpTicket.setType(type);
247
-        tpTicketMapper.updateByPrimaryKeySelective(tpTicket);
248
-    }
249 220
     @Transactional
250 221
     @Override
251 222
     public ResponseBean addAllTransaction(Integer userId, String paramets) {
223
+
252 224
         ResponseBean response = new ResponseBean();
253 225
 
254 226
         JSONObject jsonObject = JSONObject.parseObject(paramets);
@@ -275,32 +247,29 @@ public class SocialServiceImpl implements SocialServiceI {
275 247
         if (Constant.INVALID.equals(taUser.getStatus())
276 248
                 && Constant.OWNER.equals(sysRole.getRoleName())){
277 249
 
278
-            response.addError("");
279
-            return response
250
+            response.addError("9996", "您的身份已停用,请联系物业");
251
+            return response;
280 252
         }
281 253
 
282 254
         //身份为家属租客,状态为已停用
283 255
         if (Constant.INVALID.equals(taUser.getStatus())
284
-                && (Constant.FAMILYMEMBER.equals(sysRole.getRoleName())) || Constant.TENANT.equals(sysRole.getRoleName())){
256
+                && (Constant.RELATION.equals(sysRole.getRoleName())) || Constant.TENANT.equals(sysRole.getRoleName())){
285 257
 
286
-             tpTransactionMapper.insertSelective(tpTransaction);
287
-            TpTransaction tpTransaction1=tpTransactionMapper.getById(tpTransaction.getId());
288
-            response.addSuccess(tpTransaction1);
258
+            response.addError("9996", "您的身份已停用,请联系物业");
259
+            return response;
289 260
         }
290 261
 
291 262
         if (Constant.EFFECTIVE.equals(taUser.getStatus())
292
-                && (Constant.FAMILYMEMBER.equals(sysRole.getRoleName()))
263
+                && (Constant.RELATION.equals(sysRole.getRoleName()))
293 264
                 || Constant.TENANT.equals(sysRole.getRoleName())
294 265
                 || Constant.OWNER.equals(sysRole.getRoleName())){
295 266
             tpTransactionMapper.insertSelective(tpTransaction);
296 267
             TpTransaction tpTransaction1=tpTransactionMapper.getById(tpTransaction.getId());
297 268
             response.addSuccess(tpTransaction1);
298 269
         }
299
-        response.addError("9999", "服务器异常");
270
+        response.addError("9995", "无法确认您的身份,请联系物业");
300 271
         return response;
301 272
 
302
-
303
-
304 273
     }
305 274
 
306 275
     @Override
@@ -366,7 +335,7 @@ public class SocialServiceImpl implements SocialServiceI {
366 335
         TpActivitySignup tpActivitySignup = new TpActivitySignup();
367 336
         tpActivitySignup.setActivityId(tpActivity.getId());
368 337
         tpActivitySignup.setCommunityId(communityId);
369
-        tpActivitySignup.setTaUserId(1);
338
+        tpActivitySignup.setTaUserId(userId);
370 339
         tpActivitySignup.setSignUpTime(new Date());
371 340
         tpActivitySignupMapper.insertSelective(tpActivitySignup);
372 341
         responseBean.addSuccess("报名成功");

+ 31
- 8
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TaUserServiceImpl.java Bestand weergeven

@@ -1,6 +1,7 @@
1 1
 package com.community.huiju.service.impl;
2 2
 
3 3
 import com.alibaba.fastjson.JSONObject;
4
+import com.community.commom.constant.Constant;
4 5
 import com.community.commom.mode.ResponseBean;
5 6
 import com.community.commom.utils.AccountValidatorUtil;
6 7
 import com.community.commom.utils.MD5Utils;
@@ -151,6 +152,17 @@ public class TaUserServiceImpl implements ITaUserService {
151 152
         //user.setLoginPassword(MD5Utils.encode(user.getLoginPassword()));
152 153
         taUserMapper.insertSelective(user);
153 154
 
155
+        user.setCreateUser(user.getId());
156
+        user.setUpdateUser(user.getId());
157
+
158
+        // 更新
159
+        taUserMapper.updateByPrimaryKeySelective(user);
160
+
161
+        // TODO 这里先默认 type=0 (租客), 后期需要和 资料库对接
162
+        addUserRole(0,response,user);
163
+
164
+
165
+
154 166
         TaUserVO taUserVO = new TaUserVO();
155 167
         BeanUtils.copyProperties(user,taUserVO);
156 168
         response.addSuccess(taUserVO);
@@ -250,17 +262,17 @@ public class TaUserServiceImpl implements ITaUserService {
250 262
             return response;
251 263
         }
252 264
         if (bool) {
253
-            if ("1".equals(user.getStatus())) {
265
+            if (Constant.EFFECTIVE.equals(user.getStatus())) {
254 266
                 response.addError("用户已启用!");
255 267
                 return response;
256 268
             }
257
-            user.setStatus("1");
269
+            user.setStatus(Constant.EFFECTIVE+"");
258 270
         } else {
259
-            if ("0".equals(user.getStatus())) {
271
+            if (Constant.INVALID.equals(user.getStatus())) {
260 272
                 response.addError("用户已停用!");
261 273
                 return response;
262 274
             }
263
-            user.setStatus("0");
275
+            user.setStatus(Constant.INVALID+"");
264 276
         }
265 277
 
266 278
         int result = taUserMapper.updateByPrimaryKeySelective(user);
@@ -303,7 +315,7 @@ public class TaUserServiceImpl implements ITaUserService {
303 315
         user.setUpdateDate(new Date());
304 316
         user.setUpdateUser(currentUserId);
305 317
         user.setParentId(currentUserId);
306
-        user.setStatus("1");
318
+        user.setStatus(Constant.EFFECTIVE+"");
307 319
         user.setVerifyStatus("1");
308 320
         user.setAcceptAgreementStatus("1");
309 321
         user.setRemark("这是业主添加的!");
@@ -317,6 +329,19 @@ public class TaUserServiceImpl implements ITaUserService {
317 329
             return response;
318 330
         }
319 331
 
332
+        addUserRole(type,response,user);
333
+
334
+        return response;
335
+    }
336
+
337
+    /**
338
+     * 公共方法,添加角色.
339
+     *      用于注册 和 业主添加家属和租客
340
+     * @param type 0 是租客  1 是家属
341
+     * @param response
342
+     * @param user
343
+     */
344
+    private void addUserRole(Integer type,ResponseBean response,TaUser user){
320 345
         // 先查询角色 在角色关联记录
321 346
         // 这里的 2 或者 3 是对应角色编号
322 347
         int roleType = type.equals("0") ? 2 : 3;
@@ -324,7 +349,7 @@ public class TaUserServiceImpl implements ITaUserService {
324 349
         if (null == taSysRole) {
325 350
             response.addError("该权限不存在!");
326 351
             log.error("这个角色没有找到!角色名称:{} 角色编号:{}",type.equals("0") ? "租客" : "家属",roleType);
327
-            return response;
352
+            return;
328 353
         }
329 354
 
330 355
         TaSysUserRole taSysUserRole = new TaSysUserRole();
@@ -343,8 +368,6 @@ public class TaUserServiceImpl implements ITaUserService {
343 368
             log.error("租客或者家属角色权限添加失败!",e);
344 369
             throw new RuntimeException("租客或者家属角色权限添加失败");
345 370
         }
346
-
347
-        return response;
348 371
     }
349 372
 
350 373
     @Transactional

+ 34
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TicketServiceImpl.java Bestand weergeven

@@ -18,6 +18,7 @@ import lombok.extern.slf4j.Slf4j;
18 18
 import org.springframework.beans.BeanUtils;
19 19
 import org.springframework.beans.factory.annotation.Autowired;
20 20
 import org.springframework.stereotype.Service;
21
+import org.springframework.transaction.annotation.Transactional;
21 22
 
22 23
 import java.util.Date;
23 24
 import java.util.List;
@@ -227,4 +228,37 @@ public class TicketServiceImpl implements ITicketService {
227 228
         //插入回复数据
228 229
         return tpTicketRecordCommentMapper.insertSelective(tpTicketRecordComment);
229 230
     }
231
+
232
+    @Override
233
+    public void updateTicketContent(Integer ticketId, TpTicket tpTicket, String type) {
234
+        tpTicket.setId(ticketId);
235
+        tpTicket.setType(type);
236
+        tpTicketMapper.updateByPrimaryKeySelective(tpTicket);
237
+    }
238
+
239
+    @Transactional
240
+    @Override
241
+    public ResponseBean stopTpTicketRecord(Integer communityId, Integer ticketId, Integer userId) {
242
+        ResponseBean responseBean = new ResponseBean();
243
+        try{
244
+            TpTicket tpTicket = new TpTicket();
245
+            tpTicket.setStatus("6");
246
+            tpTicket.setId(ticketId);
247
+            tpTicketMapper.updateByPrimaryKeySelective(tpTicket);
248
+
249
+            TpTicketRecord tpTicketRecord = new TpTicketRecord();
250
+            tpTicketRecord.setStatus("6");
251
+            tpTicketRecord.setTicketId(ticketId);
252
+            tpTicketRecord.setCommunityId(communityId);
253
+            //TODO
254
+            tpTicketRecord.setCreateUser(userId);
255
+            tpTicketRecord.setCreateDate(new Date());
256
+            tpTicketRecordMapper.insertSelective(tpTicketRecord);
257
+            return responseBean;
258
+        }catch(Exception e){
259
+            e.printStackTrace();
260
+            responseBean.addError("服务器异常");
261
+            return responseBean;
262
+        }
263
+    }
230 264
 }

+ 2
- 1
CODE/smart-community/app-api/src/main/resources/mapper/TpActivityMapper.xml Bestand weergeven

@@ -268,7 +268,8 @@
268 268
       AND a.activity_title LIKE concat('%',#{title,jdbcType=VARCHAR},'%')
269 269
   ORDER BY
270 270
       a.sort,
271
-      a.create_date DESC
271
+      a.activity_end_time DESC,
272
+	  a.create_date DESC
272 273
   </select>
273 274
 
274 275
   <select id="getActivity" resultMap="BaseResultMap" parameterType="com.community.huiju.model.TpActivity">

+ 2
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TpMessageMapper.xml Bestand weergeven

@@ -271,6 +271,8 @@
271 271
     and advice_type = 1
272 272
     and model_type = 1
273 273
     and source = 1
274
+    and uuid_type = 1
275
+    and uuid = #{userId}
274 276
   </update>
275 277
 
276 278
 </mapper>

+ 7
- 4
CODE/smart-community/community-common/src/main/java/com/community/commom/constant/Constant.java Bestand weergeven

@@ -34,7 +34,7 @@ public class Constant {
34 34
     public static final String REQUEST_URL = "http://micservice.ycjcjy.com/sms";
35 35
 
36 36
     /** 本地缓存过期时间 单位秒 **/
37
-    public static final Long CACHE_EXPIRE = 60L;
37
+    public static final Long CACHE_EXPIRE = 120L;
38 38
 
39 39
     /** 本地緩存最大个数 **/
40 40
     public static final Long CACHE_SIZE = 1000L;
@@ -54,6 +54,9 @@ public class Constant {
54 54
     /** 社交二手租赁类型**/
55 55
     public static final String LEASE = "lease";
56 56
 
57
+    /** banner类型公告**/
58
+    public static final String BANNER = "banner";
59
+
57 60
     /**有效状态**/
58 61
     public static final Integer EFFECTIVE = 1;
59 62
 
@@ -61,13 +64,13 @@ public class Constant {
61 64
     public static final Integer INVALID = 0;
62 65
 
63 66
     /**业主角色**/
64
-    public static final String OWNER = "owner";
67
+    public static final String OWNER = "OWNER";
65 68
 
66 69
     /**租客角色**/
67
-    public static final String TENANT = "tenant";
70
+    public static final String TENANT = "TENANT";
68 71
 
69 72
     /**家属角色**/
70
-    public static final String FAMILYMEMBER = "familyMember";
73
+    public static final String RELATION = "RELATION";
71 74
     
72 75
     /** 工单回复的发起人 **/
73 76
     public static final String TICKET_USER_TYPE = "1";

BIN
CODE/smart-community/community-common/target/classes/com/community/commom/constant/Constant.class Bestand weergeven


+ 3
- 2
CODE/smart-community/zuul/src/main/java/com/community/huiju/security/RestAuthenticationEntryPoint.java Bestand weergeven

@@ -33,9 +33,10 @@ public class RestAuthenticationEntryPoint implements AuthenticationEntryPoint {
33 33
             } else if (Status.RESPONSE_STATUS_801.getValue().equals(headerError)) {
34 34
                 result.addError("401","请您登陆!");
35 35
             }
36
-        }else {
37
-            result.addError("403",Status.RESPONSE_STATUS_401.getComment());
38 36
         }
37
+//        else {
38
+//            result.addError("403",Status.RESPONSE_STATUS_401.getComment());
39
+//        }
39 40
 
40 41
         try {
41 42
             //设置跨域请求 请求结果json刷到响应里

+ 3
- 1
CODE/smart-community/zuul/src/main/java/com/community/huiju/security/RestPreAuthenticatedProcessingFilter.java Bestand weergeven

@@ -9,8 +9,10 @@ import com.community.huiju.service.IRoleService;
9 9
 import com.google.common.collect.Lists;
10 10
 import lombok.extern.slf4j.Slf4j;
11 11
 import org.apache.commons.lang.StringUtils;
12
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
12 13
 import org.springframework.security.core.GrantedAuthority;
13 14
 import org.springframework.security.core.authority.SimpleGrantedAuthority;
15
+import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
14 16
 import org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter;
15 17
 import org.springframework.util.AntPathMatcher;
16 18
 
@@ -74,7 +76,7 @@ public class RestPreAuthenticatedProcessingFilter extends AbstractPreAuthenticat
74 76
                 }
75 77
 
76 78
                 grantedAuthorityList = roleDTOList.stream()
77
-                        .map(e->new SimpleGrantedAuthority("ROLE_OWNER")) //
79
+                        .map(e->new SimpleGrantedAuthority(e.getRoleName()))
78 80
                         .collect(Collectors.toList());
79 81
             } catch (Exception e){
80 82
                 log.error("用户授权失败!",e);

+ 7
- 7
CODE/smart-community/zuul/src/main/java/com/community/huiju/security/WisdomSecurityConfig.java Bestand weergeven

@@ -35,8 +35,8 @@ public class WisdomSecurityConfig extends WebSecurityConfigurerAdapter {
35 35
      */
36 36
     private RestPreAuthenticatedProcessingFilter getPreAuthenticatedProcessingFilter() throws Exception {
37 37
         RestPreAuthenticatedProcessingFilter filter = new RestPreAuthenticatedProcessingFilter(parametes.getNoneSercurityPath(),iRoleService);
38
-        //filter.setAuthenticationManager(this.authenticationManagerBean());
39
-        filter.setAuthenticationManager(new RestPreAuthenticateManager());
38
+        filter.setAuthenticationManager(this.authenticationManagerBean());
39
+        //filter.setAuthenticationManager(new RestPreAuthenticateManager());
40 40
         return filter;
41 41
     }
42 42
 
@@ -45,11 +45,11 @@ public class WisdomSecurityConfig extends WebSecurityConfigurerAdapter {
45 45
      * @param auth
46 46
      * @throws Exception
47 47
      */
48
-//    @Override
49
-//    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
50
-//        auth.authenticationProvider(new RestPreAuthenticateProvider());
51
-//        //super.configure(auth);
52
-//    }
48
+    @Override
49
+    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
50
+        auth.authenticationProvider(new RestPreAuthenticateProvider());
51
+        //super.configure(auth);
52
+    }
53 53
 
54 54
     /**
55 55
      * 安全策略

+ 88
- 0
CODE/smart-community/zuul/src/main/java/com/community/huiju/security/dome/TokenAuthrentication.java Bestand weergeven

@@ -0,0 +1,88 @@
1
+package com.community.huiju.security.dome;
2
+
3
+import org.springframework.security.authentication.AbstractAuthenticationToken;
4
+import org.springframework.security.core.GrantedAuthority;
5
+import org.springframework.security.core.SpringSecurityCoreVersion;
6
+
7
+import java.util.Collection;
8
+
9
+/**
10
+ * 认证
11
+ * @author weiximei
12
+ */
13
+public class TokenAuthrentication extends AbstractAuthenticationToken {
14
+
15
+    private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID;
16
+
17
+    // ~ Instance fields
18
+    // ================================================================================================
19
+
20
+    private final Object principal; // 存储认证信息的
21
+    //private Object credentials; // 存放密码
22
+
23
+    // ~ Constructors
24
+    // ===================================================================================================
25
+
26
+    /**
27
+     * This constructor can be safely used by any code that wishes to create a
28
+     * <code>SmsCodeAuthenticationToken</code>, as the {@link #isAuthenticated()}
29
+     * will return <code>false</code>.
30
+     *
31
+     */
32
+    public TokenAuthrentication(String token) {
33
+        super(null);
34
+        this.principal = token; // 存放token
35
+        //this.credentials = credentials;
36
+        // 是否认证
37
+        setAuthenticated(false);
38
+    }
39
+
40
+    /**
41
+     * This constructor should only be used by <code>AuthenticationManager</code> or
42
+     * <code>AuthenticationProvider</code> implementations that are satisfied with
43
+     * producing a trusted (i.e. {@link #isAuthenticated()} = <code>true</code>)
44
+     * authentication token.
45
+     *
46
+     * @param principal
47
+     * @param authorities
48
+     */
49
+    // principal 用户认证信息,authorities用户的权限
50
+    public TokenAuthrentication(Object principal,
51
+                                      Collection<? extends GrantedAuthority> authorities) {
52
+        super(authorities);
53
+        this.principal = principal; // 登录成功,存放用户信息
54
+        // this.credentials = credentials;
55
+        // 是否认证
56
+        super.setAuthenticated(true); // must use super, as we override
57
+    }
58
+
59
+    // ~ Methods
60
+    // ========================================================================================================
61
+    @Override
62
+    public Object getCredentials() {
63
+        //return this.credentials;
64
+        return null;
65
+    }
66
+
67
+    @Override
68
+    public Object getPrincipal() {
69
+        return this.principal;
70
+    }
71
+
72
+    @Override
73
+    public void setAuthenticated(boolean isAuthenticated) throws IllegalArgumentException {
74
+        if (isAuthenticated) {
75
+            throw new IllegalArgumentException(
76
+                    "Cannot set this token to trusted - use constructor which takes a GrantedAuthority list instead");
77
+        }
78
+
79
+        super.setAuthenticated(false);
80
+    }
81
+
82
+    @Override
83
+    public void eraseCredentials() {
84
+        super.eraseCredentials();
85
+        // credentials = null;
86
+    }
87
+
88
+}