魏超 6 年 前
コミット
6b9e7f5645
共有20 個のファイルを変更した268 個の追加52 個の削除を含む
  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. 22
    14
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/SocialController.java
  4. 2
    2
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/TicketController.java
  5. 2
    2
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/UserController.java
  6. 8
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpActivityMapper.java
  7. 1
    1
      CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpCarouselSettingMapper.java
  8. 3
    1
      CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpTransactionMapper.java
  9. 9
    2
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/SocialServiceI.java
  10. 58
    6
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/SocialServiceImpl.java
  11. 31
    8
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TaUserServiceImpl.java
  12. 1
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TicketServiceImpl.java
  13. 7
    0
      CODE/smart-community/app-api/src/main/resources/mapper/TpActivityMapper.xml
  14. 8
    2
      CODE/smart-community/app-api/src/main/resources/mapper/TpTransactionMapper.xml
  15. 1
    1
      CODE/smart-community/community-common/src/main/java/com/community/commom/constant/Constant.java
  16. バイナリ
      CODE/smart-community/community-common/target/classes/com/community/commom/constant/Constant.class
  17. 3
    2
      CODE/smart-community/zuul/src/main/java/com/community/huiju/security/RestAuthenticationEntryPoint.java
  18. 3
    1
      CODE/smart-community/zuul/src/main/java/com/community/huiju/security/RestPreAuthenticatedProcessingFilter.java
  19. 7
    7
      CODE/smart-community/zuul/src/main/java/com/community/huiju/security/WisdomSecurityConfig.java
  20. 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 ファイルの表示

@@ -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 ファイルの表示

@@ -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
         }

+ 22
- 14
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/SocialController.java ファイルの表示

@@ -86,6 +86,18 @@ public class SocialController {
86 86
         return responseBean;
87 87
     }
88 88
 
89
+    @ApiOperation(value = "获取活动轮播图", notes = "获取活动轮播图")
90
+    @ApiImplicitParams({
91
+            @ApiImplicitParam(paramType = "path", dataType = "String", name = "communityId", value = "小区id")
92
+    })
93
+    @RequestMapping(value = "/activity/Img/{communityId}", method = RequestMethod.GET)
94
+    public ResponseBean getActivity(@PathVariable(value = "communityId") Integer communityId) {
95
+        ResponseBean responseBean = new ResponseBean();
96
+        List<TpActivity> agreement = socialServiceI.getActivity(communityId);
97
+        responseBean.addSuccess(agreement);
98
+        return responseBean;
99
+    }
100
+
89 101
 
90 102
     @ApiOperation(value = "按小区获取分页活动列表", notes = "按小区获取分页活动列表,公告标题模糊查询")
91 103
     @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "String", name = "communityId", value = "小区Id"),
@@ -120,7 +132,7 @@ public class SocialController {
120 132
     @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
121 133
             @ApiImplicitParam(paramType = "query", dataType = "integer", name = "activityId", value = "活动帖子id"),
122 134
             @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")})
123
-    @RequestMapping(value = "/secondHand/{communityId}", method = RequestMethod.GET)
135
+    @RequestMapping(value = "/getTransaction/{communityId}", method = RequestMethod.GET)
124 136
     public ResponseBean findUsedDetails(@PathVariable(value = "communityId") Integer communityId, @RequestParam("activityId") Integer activityId, HttpSession session) {
125 137
         ResponseBean responseBean = new ResponseBean();
126 138
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
@@ -147,23 +159,23 @@ public class SocialController {
147 159
 
148 160
     @ApiOperation(value = "添加二手租赁帖子", notes = "添加二手租赁帖子")
149 161
     @ApiImplicitParams({
150
-            @ApiImplicitParam(paramType = "query", dataType = "String", name = "transactionTitle", value = "交易标题"),
151
-            @ApiImplicitParam(paramType = "query", dataType = "String", name = "transactionContent", value = "交易内容"),
152
-            @ApiImplicitParam(paramType = "query", dataType = "String", name = "type", value = "0:二手 1:求购  2:租赁"),
162
+            @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value =
163
+                    "title:小区标题,content:小区类容, type"),
153 164
             @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
154 165
     })
155 166
     @RequestMapping(value = "/addTransaction", method = RequestMethod.POST)
156 167
     @ResponseBody
157
-    public ResponseBean addTransaction(TpTransaction tpTransaction, HttpSession session) {
168
+    public ResponseBean addTransaction(@RequestBody String paramets, HttpSession session) {
158 169
         ResponseBean responseBean = new ResponseBean();
159 170
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
160 171
         Integer userId = userElement.getId();
161
-        ResponseBean response = socialServiceI.addAllTransaction(userId, tpTransaction);
172
+        ResponseBean response = socialServiceI.addAllTransaction(userId, paramets);
162 173
         return response;
163 174
     }
164 175
 
165 176
     @ApiOperation(value = "获取我发布所有二手租赁帖子", notes = "获取我发布所有二手租赁帖子")
166 177
     @ApiImplicitParams({
178
+            @ApiImplicitParam(paramType = "query", dataType = "String", name = "type", value = "帖子类型"),
167 179
             @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageNum", value = "分页第几页"),
168 180
             @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageSize", value = "分页每页长度"),
169 181
             @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
@@ -181,20 +193,16 @@ public class SocialController {
181 193
 
182 194
     @ApiOperation(value = "修改二手租赁帖子", notes = "修改二手租赁帖子")
183 195
     @ApiImplicitParams({
184
-            @ApiImplicitParam(paramType = "query", dataType = "String", name = "transactionTitle", value = "小区标题"),
185
-            @ApiImplicitParam(paramType = "body", dataType = "String", name = "transactionContent", value = "交易内容"),
186
-            @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "Type", value = "0 代表,1求购,2租赁"),
196
+            @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value =
197
+                    "id:小区id,title:小区标题,content:小区类容"),
187 198
             @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
188 199
     })
189 200
     @RequestMapping(value = "/updateTransaction/{Id}", method = RequestMethod.PUT)
190
-    public ResponseBean ubdateTransaction(HttpSession session, @PathVariable(value = "Id") Integer Id,
191
-                                          @RequestParam(value = "transactionTitle") String transactionTitle,
192
-                                          @RequestParam(value = "transactionContent") String transactionContent,
193
-                                          @RequestParam(value = "Type") Integer Type) {
201
+    public ResponseBean ubdateTransaction(HttpSession session, @RequestBody String paramets) {
194 202
         ResponseBean responseBean = new ResponseBean();
195 203
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
196 204
         Integer userId = userElement.getId();
197
-        ResponseBean response = socialServiceI.updateTransaction(Id, transactionTitle, transactionContent, userId, Type);
205
+        ResponseBean response = socialServiceI.updateTransaction(paramets, userId);
198 206
         return response;
199 207
     }
200 208
 

+ 2
- 2
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/TicketController.java ファイルの表示

@@ -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 = "报修房屋类型"),

+ 2
- 2
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/UserController.java ファイルの表示

@@ -61,8 +61,8 @@ public class UserController {
61 61
     }
62 62
     @ApiOperation(value = "修改手机号", notes = "修改手机号")
63 63
     @ApiImplicitParams({
64
-            @ApiImplicitParam(paramType = "query",dataType = "String",name = "phone",value = "登陆(手机号)"),
65
-            @ApiImplicitParam(paramType = "query",dataType = "String",name = "code",value = "验证码"),
64
+            @ApiImplicitParam(paramType = "body",dataType = "String",name = "phone",value = "phone:登陆(手机号),code:(手机验证码)"),
65
+
66 66
             @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
67 67
     })
68 68
             @RequestMapping(value = "/user/phone",method = RequestMethod.PUT)

+ 8
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpActivityMapper.java ファイルの表示

@@ -23,4 +23,12 @@ public interface TpActivityMapper {
23 23
     int updateByPrimaryKey(TpActivity record);
24 24
     
25 25
     List<TpActivity> getActivitys(@Param("communityId")Integer communityId,@Param("title") String title);
26
+
27
+    /**
28
+     * 获取活动轮播图
29
+     * @param communityId
30
+     * @param num
31
+     * @return
32
+     */
33
+    List<TpActivity> getActivity(@Param("communityId")Integer communityId, @Param("num")Integer num);
26 34
 }

+ 1
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpCarouselSettingMapper.java ファイルの表示

@@ -17,7 +17,7 @@ public interface TpCarouselSettingMapper {
17 17
 
18 18
     int updateByPrimaryKey(TpCarouselSetting record);
19 19
 
20
-     int getcarouselNum(String lease);
20
+     Integer getcarouselNum(String lease);
21 21
 
22 22
     Integer selectCarouselNum(String carouselType);
23 23
 

+ 3
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpTransactionMapper.java ファイルの表示

@@ -24,5 +24,7 @@ public interface TpTransactionMapper {
24 24
 
25 25
     List<TpTransaction> selectTransaction(@Param("userId")Integer userId, @Param("communityId")Integer communityId);
26 26
 
27
-    void updateTransaction(@Param("id")Integer id, @Param("transactionTitle")String transactionTitle, @Param("transactionContent")String transactionContent, @Param("userId")Integer userId,@Param("Type")Integer Type);
27
+    void updateTransaction(@Param("id")Integer id, @Param("transactionTitle")String transactionTitle, @Param("transactionContent")String transactionContent, @Param("userId")Integer userId);
28
+
29
+    TpTransaction getById(@Param("id")Integer id);
28 30
 }

+ 9
- 2
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/SocialServiceI.java ファイルの表示

@@ -69,7 +69,7 @@ public interface SocialServiceI {
69 69
 	/**
70 70
 	 * 添加二手租赁帖子
71 71
 	 */
72
-    ResponseBean addAllTransaction(Integer userId,  TpTransaction Transaction);
72
+    ResponseBean addAllTransaction(Integer userId, String paramets);
73 73
 
74 74
 	/**
75 75
 	 * 获取当前用户所有的帖子
@@ -81,7 +81,7 @@ public interface SocialServiceI {
81 81
 	/**
82 82
 	 * 修改当前帖子
83 83
 	 */
84
-	ResponseBean updateTransaction(Integer Id,String transactionTitle,String transactionContent,Integer userId,Integer Type);
84
+	ResponseBean updateTransaction(String paramets,Integer userId);
85 85
 
86 86
 	/**
87 87
 	 * 评价工单以及评分
@@ -90,4 +90,11 @@ public interface SocialServiceI {
90 90
 	 * @param ticketId
91 91
 	 */
92 92
 	void accessTicket(Integer communityId, TpTicket tpTicket, String ticketId, Integer userId);
93
+
94
+	/**
95
+	 * 获取活动轮播图
96
+	 * @param communityId
97
+	 * @return
98
+	 */
99
+	List<TpActivity> getActivity(Integer communityId);
93 100
 }

+ 58
- 6
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/SocialServiceImpl.java ファイルの表示

@@ -216,11 +216,23 @@ public class SocialServiceImpl implements SocialServiceI {
216 216
         return tpTransactionMapper.findAllTransaction(communityId, type);
217 217
     }
218 218
 
219
+
219 220
     @Transactional
220 221
     @Override
221
-    public ResponseBean addAllTransaction(Integer userId, TpTransaction tpTransaction) {
222
+    public ResponseBean addAllTransaction(Integer userId, String paramets) {
223
+
222 224
         ResponseBean response = new ResponseBean();
225
+
226
+        JSONObject jsonObject = JSONObject.parseObject(paramets);
227
+        String transactionTitle = (String) jsonObject.get("title");
228
+        String transactionContent = (String) jsonObject.get("content");
229
+        String  type= (String) jsonObject.get("type");
230
+
223 231
         TaUser user=taUserMapper.selectByPrimaryKey(userId);
232
+        TpTransaction tpTransaction=new TpTransaction();
233
+        tpTransaction.setTransactionTitle(transactionTitle);
234
+        tpTransaction.setTransactionContent(transactionContent);
235
+        tpTransaction.setType(type);
224 236
         tpTransaction.setCommunityId(user.getCommunityId());
225 237
         tpTransaction.setTaUserId(userId);
226 238
         tpTransaction.setCreateUser(userId);
@@ -228,26 +240,59 @@ public class SocialServiceImpl implements SocialServiceI {
228 240
         tpTransaction.setCreateDate(new Date());
229 241
         tpTransaction.setUpdateUser(userId);
230 242
         tpTransaction.setUpdateDate(new Date());
231
-        tpTransactionMapper.insertSelective(tpTransaction);
232
-        response.addSuccess("发布成功");
243
+
244
+        //判断身份是否为业主且状态为已停用
245
+        TaSysRole sysRole = taSysRoleMapper.findRoleByUserId(userId);
246
+        TaUser taUser = taUserMapper.selectByPrimaryKey(userId);
247
+        if (Constant.INVALID.equals(taUser.getStatus())
248
+                && Constant.OWNER.equals(sysRole.getRoleName())){
249
+
250
+            response.addError("9996", "您的身份已停用,请联系物业");
251
+            return response;
252
+        }
253
+
254
+        //身份为家属租客,状态为已停用
255
+        if (Constant.INVALID.equals(taUser.getStatus())
256
+                && (Constant.RELATION.equals(sysRole.getRoleName())) || Constant.TENANT.equals(sysRole.getRoleName())){
257
+
258
+            response.addError("9996", "您的身份已停用,请联系物业");
259
+            return response;
260
+        }
261
+
262
+        if (Constant.EFFECTIVE.equals(taUser.getStatus())
263
+                && (Constant.RELATION.equals(sysRole.getRoleName()))
264
+                || Constant.TENANT.equals(sysRole.getRoleName())
265
+                || Constant.OWNER.equals(sysRole.getRoleName())){
266
+            tpTransactionMapper.insertSelective(tpTransaction);
267
+            TpTransaction tpTransaction1=tpTransactionMapper.getById(tpTransaction.getId());
268
+            response.addSuccess(tpTransaction1);
269
+        }
270
+        response.addError("9995", "无法确认您的身份,请联系物业");
233 271
         return response;
272
+
234 273
     }
235 274
 
236 275
     @Override
237 276
     public ResponseBean selectAllTransaction(Integer userId,Integer pageNum,Integer paeSize) {
238
-        PageHelper.startPage(pageNum, paeSize);
239 277
         ResponseBean responseBean = new ResponseBean();
240 278
         TaUser user=taUserMapper.selectByPrimaryKey(userId);
241 279
          Integer communityId=user.getCommunityId();
280
+
281
+        PageHelper.startPage(pageNum, paeSize);
242 282
         List<TpTransaction> tpTransactions=tpTransactionMapper.selectTransaction(userId,communityId);
283
+
243 284
         responseBean.addSuccess(tpTransactions);
244 285
         return responseBean;
245 286
     }
246 287
 
247 288
     @Override
248
-    public ResponseBean updateTransaction(Integer Id,String transactionTitle,String transactionContent,Integer userId,Integer Type) {
289
+    public ResponseBean updateTransaction(String paramets,Integer userId) {
249 290
         ResponseBean response = new ResponseBean();
250
-        tpTransactionMapper.updateTransaction(Id,transactionTitle,transactionContent,userId,Type);
291
+        JSONObject jsonObject = JSONObject.parseObject(paramets);
292
+        String id = (String) jsonObject.get("id");
293
+        String transactionTitle = (String) jsonObject.get("title");
294
+        String transactionContent = (String) jsonObject.get("content");
295
+        tpTransactionMapper.updateTransaction(Integer.valueOf(id),transactionTitle,transactionContent,userId);
251 296
         response.addSuccess("修改成功");
252 297
         return response;
253 298
     }
@@ -270,6 +315,13 @@ public class SocialServiceImpl implements SocialServiceI {
270 315
         tpTicketRecordMapper.insertSelective(record);
271 316
     }
272 317
 
318
+    @Override
319
+    public List<TpActivity> getActivity(Integer communityId) {
320
+        Integer Num=tpCarouselSettingMapper.getcarouselNum(Constant.ACTIVITY);
321
+        List<TpActivity> listActivity=tpActivityMapper.getActivity(communityId,Num);
322
+        return listActivity;
323
+    }
324
+
273 325
     public ResponseBean insertActivitySignUp(TpActivity tpActivity, Integer communityId, Integer userId){
274 326
         ResponseBean responseBean = new ResponseBean();
275 327
         //判断是否已经报名

+ 31
- 8
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TaUserServiceImpl.java ファイルの表示

@@ -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

+ 1
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TicketServiceImpl.java ファイルの表示

@@ -205,6 +205,7 @@ public class TicketServiceImpl implements ITicketService {
205 205
         tpTicketRecord.setStatus(tpTicketReco.getStatus());
206 206
         tpTicketRecord.setCreateUser(userId);
207 207
         tpTicketRecord.setCreateDate(new Date());
208
+
208 209
         tpTicketRecordMapper.insertSelective(tpTicketRecord);
209 210
         response.addSuccess("新增成功");
210 211
         return response;

+ 7
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TpActivityMapper.xml ファイルの表示

@@ -271,4 +271,11 @@
271 271
       a.activity_end_time DESC,
272 272
 	  a.create_date DESC
273 273
   </select>
274
+
275
+  <select id="getActivity" resultMap="BaseResultMap">
276
+    select
277
+    <include refid="Base_Column_List" />
278
+    from tp_activity
279
+    where community_id = #{communityId,jdbcType=INTEGER}  and status=1 limit  #{num,jdbcType=INTEGER}
280
+  </select>
274 281
 </mapper>

+ 8
- 2
CODE/smart-community/app-api/src/main/resources/mapper/TpTransactionMapper.xml ファイルの表示

@@ -41,7 +41,7 @@
41 41
       #{type,jdbcType=CHAR}, #{createUser,jdbcType=INTEGER}, #{createDate,jdbcType=TIMESTAMP}, 
42 42
       #{updateUser,jdbcType=INTEGER}, #{updateDate,jdbcType=TIMESTAMP})
43 43
   </insert>
44
-  <insert id="insertSelective" parameterType="com.community.huiju.model.TpTransaction" >
44
+  <insert id="insertSelective" useGeneratedKeys="true" keyProperty="id"  parameterType="com.community.huiju.model.TpTransaction" >
45 45
     insert into tp_transaction
46 46
     <trim prefix="(" suffix=")" suffixOverrides="," >
47 47
       <if test="id != null" >
@@ -195,9 +195,15 @@
195 195
     ta_user_id = #{userId,jdbcType=INTEGER},
196 196
     transaction_title = #{transactionTitle,jdbcType=VARCHAR},
197 197
     transaction_content = #{transactionContent,jdbcType=VARCHAR},
198
-     type = #{Type,jdbcType=CHAR},
199 198
     update_user = #{userId,jdbcType=INTEGER},
200 199
     update_date = now()
201 200
     where id = #{id,jdbcType=INTEGER}
202 201
   </update>
202
+
203
+  <select id="getById" resultMap="BaseResultMap" parameterType="com.community.huiju.model.TpTransaction">
204
+    select
205
+    <include refid="Base_Column_List" />
206
+    from tp_transaction
207
+    where id = #{id,jdbcType=INTEGER}
208
+  </select>
203 209
 </mapper>

+ 1
- 1
CODE/smart-community/community-common/src/main/java/com/community/commom/constant/Constant.java ファイルの表示

@@ -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;

バイナリ
CODE/smart-community/community-common/target/classes/com/community/commom/constant/Constant.class ファイルの表示


+ 3
- 2
CODE/smart-community/zuul/src/main/java/com/community/huiju/security/RestAuthenticationEntryPoint.java ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

@@ -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
+}