dingxin 6 gadus atpakaļ
vecāks
revīzija
b026edd9dc

+ 16
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/SocialController.java Parādīt failu

@@ -2,9 +2,11 @@ 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.huiju.config.entity.UserElement;
5 6
 import com.community.huiju.model.TpActivity;
6 7
 import com.community.huiju.model.TpAnnouncement;
7 8
 import com.community.huiju.model.TpMessage;
9
+import com.community.huiju.model.TpTransaction;
8 10
 import com.community.huiju.service.SocialServiceI;
9 11
 import io.swagger.annotations.Api;
10 12
 import io.swagger.annotations.ApiImplicitParam;
@@ -14,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
14 16
 import org.springframework.cloud.context.config.annotation.RefreshScope;
15 17
 import org.springframework.web.bind.annotation.*;
16 18
 
19
+import javax.servlet.http.HttpSession;
17 20
 import java.util.List;
18 21
 
19 22
 /**
@@ -103,4 +106,17 @@ public class SocialController {
103 106
         return responseBean;
104 107
     }
105 108
 
109
+    @ApiOperation(value = "二手租赁详情", notes = "二手租赁详情")
110
+    @ApiImplicitParams({ @ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
111
+            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "activityId", value = "活动帖子id")})
112
+    @RequestMapping(value = "/secondHand/{communityId}", method = RequestMethod.GET)
113
+    public ResponseBean findUsedDetails(@PathVariable(value = "communityId")Integer communityId, @RequestParam("activityId") Integer activityId, HttpSession session){
114
+        ResponseBean responseBean = new ResponseBean();
115
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
116
+        Integer userId=userElement.getId();
117
+        TpTransaction activity = socialServiceI.findUsedDetails(activityId, communityId,userId);
118
+        responseBean.addSuccess(activity);
119
+        return responseBean;
120
+    }
121
+
106 122
 }

+ 14
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/UserController.java Parādīt failu

@@ -11,6 +11,7 @@ import io.swagger.annotations.Api;
11 11
 import io.swagger.annotations.ApiImplicitParam;
12 12
 import io.swagger.annotations.ApiImplicitParams;
13 13
 import io.swagger.annotations.ApiOperation;
14
+import org.apache.catalina.User;
14 15
 import org.springframework.beans.BeanUtils;
15 16
 import org.springframework.beans.factory.annotation.Autowired;
16 17
 import org.springframework.cloud.context.config.annotation.RefreshScope;
@@ -55,7 +56,19 @@ public class UserController {
55 56
         return responseBean;
56 57
 
57 58
     }
58
-
59
+    @ApiOperation(value = "修改手机号", notes = "修改手机号")
60
+    @ApiImplicitParams({
61
+            @ApiImplicitParam(paramType = "query",dataType = "String",name = "phone",value = "登陆(手机号)"),
62
+            @ApiImplicitParam(paramType = "query",dataType = "String",name = "code",value = "验证码")
63
+    })
64
+            @RequestMapping(value = "/user/phone",method = RequestMethod.PUT)
65
+    public ResponseBean update(@RequestParam(value = "phone") String phone,@RequestParam(value = "code")String code,HttpSession session){
66
+        ResponseBean responseBean = new ResponseBean();
67
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
68
+        Integer userId=userElement.getId();
69
+        ResponseBean response=iTaUserService.selectloginName(userId,phone,code);
70
+        return response;
71
+    }
59 72
 
60 73
 
61 74
 }

+ 7
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TaUserMapper.java Parādīt failu

@@ -32,4 +32,11 @@ public interface TaUserMapper {
32 32
      * @return 用户
33 33
      */
34 34
     TaUser selectByLoginName(Map<String, Object> map);
35
+
36
+    /**
37
+     * 更新当前用户电话
38
+     * @param record
39
+     * @return
40
+     */
41
+    TaUser ubdateLongName(TaUser record);
35 42
 }

+ 2
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpTransactionMapper.java Parādīt failu

@@ -2,6 +2,7 @@ package com.community.huiju.dao;
2 2
 
3 3
 import com.community.huiju.model.TpTransaction;
4 4
 import org.apache.ibatis.annotations.Mapper;
5
+import org.apache.ibatis.annotations.Param;
5 6
 
6 7
 @Mapper
7 8
 public interface TpTransactionMapper {
@@ -11,7 +12,7 @@ public interface TpTransactionMapper {
11 12
 
12 13
     int insertSelective(TpTransaction record);
13 14
 
14
-    TpTransaction selectByPrimaryKey(Integer id);
15
+    TpTransaction selectByPrimaryKey(@Param("id") Integer id,@Param("communityId")  Integer communityId);
15 16
 
16 17
     int updateByPrimaryKeySelective(TpTransaction record);
17 18
 

+ 7
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/ITaUserService.java Parādīt failu

@@ -2,7 +2,6 @@ package com.community.huiju.service;
2 2
 
3 3
 import com.community.commom.mode.ResponseBean;
4 4
 import com.community.huiju.model.TaUser;
5
-import org.springframework.web.bind.annotation.RequestParam;
6 5
 
7 6
 /**
8 7
  * 用户业务 接口
@@ -33,6 +32,13 @@ public interface ITaUserService {
33 32
      */
34 33
     ResponseBean register(TaUser user);
35 34
 
35
+    /**
36
+     * 查询当前用户信息
37
+     * @param id
38
+     * @return
39
+     */
40
+    ResponseBean selectloginName(Integer id, String phone, String code);
41
+
36 42
 
37 43
 
38 44
 }

+ 9
- 4
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/SocialServiceI.java Parādīt failu

@@ -1,10 +1,7 @@
1 1
 package com.community.huiju.service;
2 2
 
3 3
 import com.community.commom.mode.ResponseBean;
4
-import com.community.huiju.model.TaUser;
5
-import com.community.huiju.model.TpActivity;
6
-import com.community.huiju.model.TpAnnouncement;
7
-import com.community.huiju.model.TpSocialView;
4
+import com.community.huiju.model.*;
8 5
 
9 6
 import java.util.List;
10 7
 
@@ -53,4 +50,12 @@ public interface SocialServiceI {
53 50
 	TpActivity findActivityDetail(Integer activityId, Integer communityId);
54 51
 
55 52
 	ResponseBean findTaUserInfo(Integer id, Integer communityId);
53
+
54
+	/**
55
+	 * 获取二手租赁详情
56
+	 * @param activityId
57
+	 * @param communityId
58
+	 * @return
59
+	 */
60
+	TpTransaction findUsedDetails(Integer activityId, Integer communityId, Integer userId);
56 61
 }

+ 17
- 5
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/SocialServiceImpl.java Parādīt failu

@@ -2,12 +2,8 @@ package com.community.huiju.service.impl;
2 2
 
3 3
 import com.community.commom.constant.Constant;
4 4
 import com.community.commom.mode.ResponseBean;
5
-import com.community.commom.utils.DateUtils;
6 5
 import com.community.huiju.dao.*;
7
-import com.community.huiju.model.TaUser;
8
-import com.community.huiju.model.TpActivity;
9
-import com.community.huiju.model.TpAnnouncement;
10
-import com.community.huiju.model.TpSocialView;
6
+import com.community.huiju.model.*;
11 7
 import com.community.huiju.service.SocialServiceI;
12 8
 import com.github.pagehelper.PageHelper;
13 9
 import org.springframework.beans.factory.annotation.Autowired;
@@ -39,6 +35,9 @@ public class SocialServiceImpl implements SocialServiceI {
39 35
 
40 36
     @Autowired
41 37
     private TpActivitySignupMapper tpActivitySignupMapper;
38
+
39
+    @Autowired
40
+    private TpTransactionMapper tpTransactionMapper;
42 41
     
43 42
     @Override
44 43
     @Transactional
@@ -168,4 +167,17 @@ public class SocialServiceImpl implements SocialServiceI {
168 167
 //        //身份为业主,状态为已停用
169 168
         return null;
170 169
     }
170
+
171
+    @Override
172
+    public TpTransaction findUsedDetails(Integer activityId, Integer communityId, Integer userId) {
173
+        Integer num = updateSocialView(userId,Constant.LEASE,communityId,activityId);
174
+        if (null != num){
175
+            TpTransaction transaction = new TpTransaction();
176
+            transaction.setId(activityId);
177
+            transaction.setViewCount(num);
178
+            tpTransactionMapper.updateByPrimaryKeySelective(transaction);
179
+        }
180
+        return tpTransactionMapper.selectByPrimaryKey(activityId,communityId);
181
+
182
+    }
171 183
 }

+ 26
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TaUserServiceImpl.java Parādīt failu

@@ -137,4 +137,30 @@ public class TaUserServiceImpl implements ITaUserService {
137 137
         response.addSuccess(taUserVO);
138 138
         return response;
139 139
     }
140
+
141
+    @Override
142
+    public ResponseBean selectloginName(Integer id, String phone, String code) {
143
+        ResponseBean response = new ResponseBean();
144
+        TaUser user=taUserMapper.selectByPrimaryKey(id);
145
+        //系统验证码
146
+        String  codes= (String) AppkeyCache.getCache(user.getLoginName());
147
+        //用户电话
148
+            /*String  phones=user.getLoginName();*/
149
+        if(codes.equals(code)){
150
+            TaUser taUser=new TaUser();
151
+            taUser.setLoginName(phone);
152
+            taUser.setId(user.getId());
153
+            taUserMapper.ubdateLongName(taUser);
154
+             response.addSuccess("修改成功");
155
+            AppkeyCache.setCache(user.getLoginName(),"null");
156
+            return response;
157
+        }else {
158
+            response.addError("验证码错误");
159
+            return response;
160
+        }
161
+
162
+
163
+
164
+    }
165
+
140 166
 }

+ 7
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TaUserMapper.xml Parādīt failu

@@ -258,4 +258,11 @@
258 258
     where login_name=#{loginName}
259 259
   </select>
260 260
 
261
+  <select id="ubdateLongName" parameterType="com.community.huiju.model.TaUser" resultMap="BaseResultMap">
262
+    update ta_user
263
+    set
264
+    login_name = #{loginName,jdbcType=VARCHAR}
265
+    where id = #{id,jdbcType=INTEGER}
266
+  </select>
267
+
261 268
 </mapper>

+ 1
- 1
CODE/smart-community/app-api/src/main/resources/mapper/TpTransactionMapper.xml Parādīt failu

@@ -29,7 +29,7 @@
29 29
     select 
30 30
     <include refid="Base_Column_List" />
31 31
     from tp_transaction
32
-    where id = #{id,jdbcType=INTEGER}
32
+    where id = #{id,jdbcType=INTEGER} and #{communityId,jdbcType=INTEGER}
33 33
   </select>
34 34
   <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
35 35
     delete from tp_transaction