魏超 6 lat temu
rodzic
commit
6b9e7f5645
20 zmienionych plików z 268 dodań i 52 usunięć
  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. BIN
      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 Wyświetl plik

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

+ 11
- 3
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/CodeController.java Wyświetl plik

2
 
2
 
3
 import com.community.commom.constant.Constant;
3
 import com.community.commom.constant.Constant;
4
 import com.community.commom.mode.ResponseBean;
4
 import com.community.commom.mode.ResponseBean;
5
+import com.community.commom.utils.AccountValidatorUtil;
5
 import com.community.huiju.common.code.ICode;
6
 import com.community.huiju.common.code.ICode;
6
 import com.community.huiju.common.code.cache.AppkeyCache;
7
 import com.community.huiju.common.code.cache.AppkeyCache;
7
 import io.swagger.annotations.Api;
8
 import io.swagger.annotations.Api;
39
     @RequestMapping(value = "/code/sendCode",method = RequestMethod.POST)
40
     @RequestMapping(value = "/code/sendCode",method = RequestMethod.POST)
40
     public ResponseBean sendCode(@RequestParam String phone, HttpSession session) {
41
     public ResponseBean sendCode(@RequestParam String phone, HttpSession session) {
41
         ResponseBean response = new ResponseBean();
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
         int code = (int) ((Math.random()*9+1)*1000);
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
         if (result) {
53
         if (result) {
46
             log.info("{} 验证码: {}",phone,code);
54
             log.info("{} 验证码: {}",phone,code);
47
             // 设置缓存
55
             // 设置缓存
48
             AppkeyCache.setCache(phone,String.valueOf(code));
56
             AppkeyCache.setCache(phone,String.valueOf(code));
49
             //session.setAttribute(Constant.SESSION_PHONE_CODE,String.valueOf(code));
57
             //session.setAttribute(Constant.SESSION_PHONE_CODE,String.valueOf(code));
50
-            response.addSuccess("发送成功!");
58
+            response.addSuccess("发送成功!"+code);
51
         } else {
59
         } else {
52
             response.addError("发送失败!");
60
             response.addError("发送失败!");
53
         }
61
         }

+ 22
- 14
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/SocialController.java Wyświetl plik

86
         return responseBean;
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
     @ApiOperation(value = "按小区获取分页活动列表", notes = "按小区获取分页活动列表,公告标题模糊查询")
102
     @ApiOperation(value = "按小区获取分页活动列表", notes = "按小区获取分页活动列表,公告标题模糊查询")
91
     @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "String", name = "communityId", value = "小区Id"),
103
     @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "String", name = "communityId", value = "小区Id"),
120
     @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
132
     @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
121
             @ApiImplicitParam(paramType = "query", dataType = "integer", name = "activityId", value = "活动帖子id"),
133
             @ApiImplicitParam(paramType = "query", dataType = "integer", name = "activityId", value = "活动帖子id"),
122
             @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")})
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
     public ResponseBean findUsedDetails(@PathVariable(value = "communityId") Integer communityId, @RequestParam("activityId") Integer activityId, HttpSession session) {
136
     public ResponseBean findUsedDetails(@PathVariable(value = "communityId") Integer communityId, @RequestParam("activityId") Integer activityId, HttpSession session) {
125
         ResponseBean responseBean = new ResponseBean();
137
         ResponseBean responseBean = new ResponseBean();
126
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
138
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
147
 
159
 
148
     @ApiOperation(value = "添加二手租赁帖子", notes = "添加二手租赁帖子")
160
     @ApiOperation(value = "添加二手租赁帖子", notes = "添加二手租赁帖子")
149
     @ApiImplicitParams({
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
             @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
164
             @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
154
     })
165
     })
155
     @RequestMapping(value = "/addTransaction", method = RequestMethod.POST)
166
     @RequestMapping(value = "/addTransaction", method = RequestMethod.POST)
156
     @ResponseBody
167
     @ResponseBody
157
-    public ResponseBean addTransaction(TpTransaction tpTransaction, HttpSession session) {
168
+    public ResponseBean addTransaction(@RequestBody String paramets, HttpSession session) {
158
         ResponseBean responseBean = new ResponseBean();
169
         ResponseBean responseBean = new ResponseBean();
159
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
170
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
160
         Integer userId = userElement.getId();
171
         Integer userId = userElement.getId();
161
-        ResponseBean response = socialServiceI.addAllTransaction(userId, tpTransaction);
172
+        ResponseBean response = socialServiceI.addAllTransaction(userId, paramets);
162
         return response;
173
         return response;
163
     }
174
     }
164
 
175
 
165
     @ApiOperation(value = "获取我发布所有二手租赁帖子", notes = "获取我发布所有二手租赁帖子")
176
     @ApiOperation(value = "获取我发布所有二手租赁帖子", notes = "获取我发布所有二手租赁帖子")
166
     @ApiImplicitParams({
177
     @ApiImplicitParams({
178
+            @ApiImplicitParam(paramType = "query", dataType = "String", name = "type", value = "帖子类型"),
167
             @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageNum", value = "分页第几页"),
179
             @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageNum", value = "分页第几页"),
168
             @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageSize", value = "分页每页长度"),
180
             @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageSize", value = "分页每页长度"),
169
             @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
181
             @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
181
 
193
 
182
     @ApiOperation(value = "修改二手租赁帖子", notes = "修改二手租赁帖子")
194
     @ApiOperation(value = "修改二手租赁帖子", notes = "修改二手租赁帖子")
183
     @ApiImplicitParams({
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
             @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
198
             @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
188
     })
199
     })
189
     @RequestMapping(value = "/updateTransaction/{Id}", method = RequestMethod.PUT)
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
         ResponseBean responseBean = new ResponseBean();
202
         ResponseBean responseBean = new ResponseBean();
195
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
203
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
196
         Integer userId = userElement.getId();
204
         Integer userId = userElement.getId();
197
-        ResponseBean response = socialServiceI.updateTransaction(Id, transactionTitle, transactionContent, userId, Type);
205
+        ResponseBean response = socialServiceI.updateTransaction(paramets, userId);
198
         return response;
206
         return response;
199
     }
207
     }
200
 
208
 

+ 2
- 2
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/TicketController.java Wyświetl plik

104
 
104
 
105
     @ApiOperation(value = "回复 报修/投诉/联系单 追问接口", notes = "回复 报修/投诉/联系单 追问接口")
105
     @ApiOperation(value = "回复 报修/投诉/联系单 追问接口", notes = "回复 报修/投诉/联系单 追问接口")
106
     @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
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
     @RequestMapping(value = "/ticket/reply/{communityId}", method = RequestMethod.POST)
109
     @RequestMapping(value = "/ticket/reply/{communityId}", method = RequestMethod.POST)
109
     public ResponseBean updateTicketsReply(@PathVariable(value = "communityId") Integer communityId, @RequestBody TpTicketRecordComment tpTicketRecordComment, HttpSession session){
110
     public ResponseBean updateTicketsReply(@PathVariable(value = "communityId") Integer communityId, @RequestBody TpTicketRecordComment tpTicketRecordComment, HttpSession session){
110
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
111
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
122
 
123
 
123
     @ApiOperation(value = "添加报修", notes = "添加报修")
124
     @ApiOperation(value = "添加报修", notes = "添加报修")
124
     @ApiImplicitParams({
125
     @ApiImplicitParams({
125
-
126
             @ApiImplicitParam(paramType = "query",dataType = "String",name = "ticketContent",value = "工单内容"),
126
             @ApiImplicitParam(paramType = "query",dataType = "String",name = "ticketContent",value = "工单内容"),
127
             @ApiImplicitParam(paramType = "query",dataType = "String",name = "ticketTitle",value = "工单标题"),
127
             @ApiImplicitParam(paramType = "query",dataType = "String",name = "ticketTitle",value = "工单标题"),
128
             @ApiImplicitParam(paramType = "query",dataType = "String",name = "repairType",value = "报修房屋类型"),
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 Wyświetl plik

61
     }
61
     }
62
     @ApiOperation(value = "修改手机号", notes = "修改手机号")
62
     @ApiOperation(value = "修改手机号", notes = "修改手机号")
63
     @ApiImplicitParams({
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
             @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
66
             @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
67
     })
67
     })
68
             @RequestMapping(value = "/user/phone",method = RequestMethod.PUT)
68
             @RequestMapping(value = "/user/phone",method = RequestMethod.PUT)

+ 8
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpActivityMapper.java Wyświetl plik

23
     int updateByPrimaryKey(TpActivity record);
23
     int updateByPrimaryKey(TpActivity record);
24
     
24
     
25
     List<TpActivity> getActivitys(@Param("communityId")Integer communityId,@Param("title") String title);
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 Wyświetl plik

17
 
17
 
18
     int updateByPrimaryKey(TpCarouselSetting record);
18
     int updateByPrimaryKey(TpCarouselSetting record);
19
 
19
 
20
-     int getcarouselNum(String lease);
20
+     Integer getcarouselNum(String lease);
21
 
21
 
22
     Integer selectCarouselNum(String carouselType);
22
     Integer selectCarouselNum(String carouselType);
23
 
23
 

+ 3
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpTransactionMapper.java Wyświetl plik

24
 
24
 
25
     List<TpTransaction> selectTransaction(@Param("userId")Integer userId, @Param("communityId")Integer communityId);
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 Wyświetl plik

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
 	/**
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
 	 * @param ticketId
90
 	 * @param ticketId
91
 	 */
91
 	 */
92
 	void accessTicket(Integer communityId, TpTicket tpTicket, String ticketId, Integer userId);
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 Wyświetl plik

216
         return tpTransactionMapper.findAllTransaction(communityId, type);
216
         return tpTransactionMapper.findAllTransaction(communityId, type);
217
     }
217
     }
218
 
218
 
219
+
219
     @Transactional
220
     @Transactional
220
     @Override
221
     @Override
221
-    public ResponseBean addAllTransaction(Integer userId, TpTransaction tpTransaction) {
222
+    public ResponseBean addAllTransaction(Integer userId, String paramets) {
223
+
222
         ResponseBean response = new ResponseBean();
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
         TaUser user=taUserMapper.selectByPrimaryKey(userId);
231
         TaUser user=taUserMapper.selectByPrimaryKey(userId);
232
+        TpTransaction tpTransaction=new TpTransaction();
233
+        tpTransaction.setTransactionTitle(transactionTitle);
234
+        tpTransaction.setTransactionContent(transactionContent);
235
+        tpTransaction.setType(type);
224
         tpTransaction.setCommunityId(user.getCommunityId());
236
         tpTransaction.setCommunityId(user.getCommunityId());
225
         tpTransaction.setTaUserId(userId);
237
         tpTransaction.setTaUserId(userId);
226
         tpTransaction.setCreateUser(userId);
238
         tpTransaction.setCreateUser(userId);
228
         tpTransaction.setCreateDate(new Date());
240
         tpTransaction.setCreateDate(new Date());
229
         tpTransaction.setUpdateUser(userId);
241
         tpTransaction.setUpdateUser(userId);
230
         tpTransaction.setUpdateDate(new Date());
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
         return response;
271
         return response;
272
+
234
     }
273
     }
235
 
274
 
236
     @Override
275
     @Override
237
     public ResponseBean selectAllTransaction(Integer userId,Integer pageNum,Integer paeSize) {
276
     public ResponseBean selectAllTransaction(Integer userId,Integer pageNum,Integer paeSize) {
238
-        PageHelper.startPage(pageNum, paeSize);
239
         ResponseBean responseBean = new ResponseBean();
277
         ResponseBean responseBean = new ResponseBean();
240
         TaUser user=taUserMapper.selectByPrimaryKey(userId);
278
         TaUser user=taUserMapper.selectByPrimaryKey(userId);
241
          Integer communityId=user.getCommunityId();
279
          Integer communityId=user.getCommunityId();
280
+
281
+        PageHelper.startPage(pageNum, paeSize);
242
         List<TpTransaction> tpTransactions=tpTransactionMapper.selectTransaction(userId,communityId);
282
         List<TpTransaction> tpTransactions=tpTransactionMapper.selectTransaction(userId,communityId);
283
+
243
         responseBean.addSuccess(tpTransactions);
284
         responseBean.addSuccess(tpTransactions);
244
         return responseBean;
285
         return responseBean;
245
     }
286
     }
246
 
287
 
247
     @Override
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
         ResponseBean response = new ResponseBean();
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
         response.addSuccess("修改成功");
296
         response.addSuccess("修改成功");
252
         return response;
297
         return response;
253
     }
298
     }
270
         tpTicketRecordMapper.insertSelective(record);
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
     public ResponseBean insertActivitySignUp(TpActivity tpActivity, Integer communityId, Integer userId){
325
     public ResponseBean insertActivitySignUp(TpActivity tpActivity, Integer communityId, Integer userId){
274
         ResponseBean responseBean = new ResponseBean();
326
         ResponseBean responseBean = new ResponseBean();
275
         //判断是否已经报名
327
         //判断是否已经报名

+ 31
- 8
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TaUserServiceImpl.java Wyświetl plik

1
 package com.community.huiju.service.impl;
1
 package com.community.huiju.service.impl;
2
 
2
 
3
 import com.alibaba.fastjson.JSONObject;
3
 import com.alibaba.fastjson.JSONObject;
4
+import com.community.commom.constant.Constant;
4
 import com.community.commom.mode.ResponseBean;
5
 import com.community.commom.mode.ResponseBean;
5
 import com.community.commom.utils.AccountValidatorUtil;
6
 import com.community.commom.utils.AccountValidatorUtil;
6
 import com.community.commom.utils.MD5Utils;
7
 import com.community.commom.utils.MD5Utils;
151
         //user.setLoginPassword(MD5Utils.encode(user.getLoginPassword()));
152
         //user.setLoginPassword(MD5Utils.encode(user.getLoginPassword()));
152
         taUserMapper.insertSelective(user);
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
         TaUserVO taUserVO = new TaUserVO();
166
         TaUserVO taUserVO = new TaUserVO();
155
         BeanUtils.copyProperties(user,taUserVO);
167
         BeanUtils.copyProperties(user,taUserVO);
156
         response.addSuccess(taUserVO);
168
         response.addSuccess(taUserVO);
250
             return response;
262
             return response;
251
         }
263
         }
252
         if (bool) {
264
         if (bool) {
253
-            if ("1".equals(user.getStatus())) {
265
+            if (Constant.EFFECTIVE.equals(user.getStatus())) {
254
                 response.addError("用户已启用!");
266
                 response.addError("用户已启用!");
255
                 return response;
267
                 return response;
256
             }
268
             }
257
-            user.setStatus("1");
269
+            user.setStatus(Constant.EFFECTIVE+"");
258
         } else {
270
         } else {
259
-            if ("0".equals(user.getStatus())) {
271
+            if (Constant.INVALID.equals(user.getStatus())) {
260
                 response.addError("用户已停用!");
272
                 response.addError("用户已停用!");
261
                 return response;
273
                 return response;
262
             }
274
             }
263
-            user.setStatus("0");
275
+            user.setStatus(Constant.INVALID+"");
264
         }
276
         }
265
 
277
 
266
         int result = taUserMapper.updateByPrimaryKeySelective(user);
278
         int result = taUserMapper.updateByPrimaryKeySelective(user);
303
         user.setUpdateDate(new Date());
315
         user.setUpdateDate(new Date());
304
         user.setUpdateUser(currentUserId);
316
         user.setUpdateUser(currentUserId);
305
         user.setParentId(currentUserId);
317
         user.setParentId(currentUserId);
306
-        user.setStatus("1");
318
+        user.setStatus(Constant.EFFECTIVE+"");
307
         user.setVerifyStatus("1");
319
         user.setVerifyStatus("1");
308
         user.setAcceptAgreementStatus("1");
320
         user.setAcceptAgreementStatus("1");
309
         user.setRemark("这是业主添加的!");
321
         user.setRemark("这是业主添加的!");
317
             return response;
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
         // 这里的 2 或者 3 是对应角色编号
346
         // 这里的 2 或者 3 是对应角色编号
322
         int roleType = type.equals("0") ? 2 : 3;
347
         int roleType = type.equals("0") ? 2 : 3;
324
         if (null == taSysRole) {
349
         if (null == taSysRole) {
325
             response.addError("该权限不存在!");
350
             response.addError("该权限不存在!");
326
             log.error("这个角色没有找到!角色名称:{} 角色编号:{}",type.equals("0") ? "租客" : "家属",roleType);
351
             log.error("这个角色没有找到!角色名称:{} 角色编号:{}",type.equals("0") ? "租客" : "家属",roleType);
327
-            return response;
352
+            return;
328
         }
353
         }
329
 
354
 
330
         TaSysUserRole taSysUserRole = new TaSysUserRole();
355
         TaSysUserRole taSysUserRole = new TaSysUserRole();
343
             log.error("租客或者家属角色权限添加失败!",e);
368
             log.error("租客或者家属角色权限添加失败!",e);
344
             throw new RuntimeException("租客或者家属角色权限添加失败");
369
             throw new RuntimeException("租客或者家属角色权限添加失败");
345
         }
370
         }
346
-
347
-        return response;
348
     }
371
     }
349
 
372
 
350
     @Transactional
373
     @Transactional

+ 1
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TicketServiceImpl.java Wyświetl plik

205
         tpTicketRecord.setStatus(tpTicketReco.getStatus());
205
         tpTicketRecord.setStatus(tpTicketReco.getStatus());
206
         tpTicketRecord.setCreateUser(userId);
206
         tpTicketRecord.setCreateUser(userId);
207
         tpTicketRecord.setCreateDate(new Date());
207
         tpTicketRecord.setCreateDate(new Date());
208
+
208
         tpTicketRecordMapper.insertSelective(tpTicketRecord);
209
         tpTicketRecordMapper.insertSelective(tpTicketRecord);
209
         response.addSuccess("新增成功");
210
         response.addSuccess("新增成功");
210
         return response;
211
         return response;

+ 7
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TpActivityMapper.xml Wyświetl plik

271
       a.activity_end_time DESC,
271
       a.activity_end_time DESC,
272
 	  a.create_date DESC
272
 	  a.create_date DESC
273
   </select>
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
 </mapper>
281
 </mapper>

+ 8
- 2
CODE/smart-community/app-api/src/main/resources/mapper/TpTransactionMapper.xml Wyświetl plik

41
       #{type,jdbcType=CHAR}, #{createUser,jdbcType=INTEGER}, #{createDate,jdbcType=TIMESTAMP}, 
41
       #{type,jdbcType=CHAR}, #{createUser,jdbcType=INTEGER}, #{createDate,jdbcType=TIMESTAMP}, 
42
       #{updateUser,jdbcType=INTEGER}, #{updateDate,jdbcType=TIMESTAMP})
42
       #{updateUser,jdbcType=INTEGER}, #{updateDate,jdbcType=TIMESTAMP})
43
   </insert>
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
     insert into tp_transaction
45
     insert into tp_transaction
46
     <trim prefix="(" suffix=")" suffixOverrides="," >
46
     <trim prefix="(" suffix=")" suffixOverrides="," >
47
       <if test="id != null" >
47
       <if test="id != null" >
195
     ta_user_id = #{userId,jdbcType=INTEGER},
195
     ta_user_id = #{userId,jdbcType=INTEGER},
196
     transaction_title = #{transactionTitle,jdbcType=VARCHAR},
196
     transaction_title = #{transactionTitle,jdbcType=VARCHAR},
197
     transaction_content = #{transactionContent,jdbcType=VARCHAR},
197
     transaction_content = #{transactionContent,jdbcType=VARCHAR},
198
-     type = #{Type,jdbcType=CHAR},
199
     update_user = #{userId,jdbcType=INTEGER},
198
     update_user = #{userId,jdbcType=INTEGER},
200
     update_date = now()
199
     update_date = now()
201
     where id = #{id,jdbcType=INTEGER}
200
     where id = #{id,jdbcType=INTEGER}
202
   </update>
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
 </mapper>
209
 </mapper>

+ 1
- 1
CODE/smart-community/community-common/src/main/java/com/community/commom/constant/Constant.java Wyświetl plik

34
     public static final String REQUEST_URL = "http://micservice.ycjcjy.com/sms";
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
     public static final Long CACHE_SIZE = 1000L;
40
     public static final Long CACHE_SIZE = 1000L;

BIN
CODE/smart-community/community-common/target/classes/com/community/commom/constant/Constant.class Wyświetl plik


+ 3
- 2
CODE/smart-community/zuul/src/main/java/com/community/huiju/security/RestAuthenticationEntryPoint.java Wyświetl plik

33
             } else if (Status.RESPONSE_STATUS_801.getValue().equals(headerError)) {
33
             } else if (Status.RESPONSE_STATUS_801.getValue().equals(headerError)) {
34
                 result.addError("401","请您登陆!");
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
         try {
41
         try {
41
             //设置跨域请求 请求结果json刷到响应里
42
             //设置跨域请求 请求结果json刷到响应里

+ 3
- 1
CODE/smart-community/zuul/src/main/java/com/community/huiju/security/RestPreAuthenticatedProcessingFilter.java Wyświetl plik

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

+ 7
- 7
CODE/smart-community/zuul/src/main/java/com/community/huiju/security/WisdomSecurityConfig.java Wyświetl plik

35
      */
35
      */
36
     private RestPreAuthenticatedProcessingFilter getPreAuthenticatedProcessingFilter() throws Exception {
36
     private RestPreAuthenticatedProcessingFilter getPreAuthenticatedProcessingFilter() throws Exception {
37
         RestPreAuthenticatedProcessingFilter filter = new RestPreAuthenticatedProcessingFilter(parametes.getNoneSercurityPath(),iRoleService);
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
         return filter;
40
         return filter;
41
     }
41
     }
42
 
42
 
45
      * @param auth
45
      * @param auth
46
      * @throws Exception
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 Wyświetl plik

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