Parcourir la source

修复 用户问题, 网关 提示乱码问题

weiximei il y a 6 ans
Parent
révision
52fe4f6a77

+ 1
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TaUserServiceImpl.java Voir le fichier

@@ -128,6 +128,7 @@ public class TaUserServiceImpl implements ITaUserService {
128 128
 
129 129
         Map<String,Object> map = Maps.newHashMap();
130 130
         map.put("loginName",loginName);
131
+        map.put("communityId", communityId);
131 132
         TaUser currentUser = taUserMapper.selectByLoginName(map);
132 133
         TaUserVO taUserVO = new TaUserVO();
133 134
         if (null != currentUser){

+ 1
- 1
CODE/smart-community/app-api/src/main/resources/mapper/TaUserMapper.xml Voir le fichier

@@ -303,7 +303,7 @@
303 303
     select
304 304
     <include refid="Base_Column_List" />
305 305
     from ta_user
306
-    where login_name=#{loginName,jdbcType=VARCHAR}
306
+    where login_name=#{loginName,jdbcType=VARCHAR} and community_id = #{communityId,jdbcType=INTEGER}
307 307
   </select>
308 308
 
309 309
   <select id="updateLongName" parameterType="com.community.huiju.model.TaUser" resultMap="BaseResultMap">

+ 19
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/controller/ActivityController.java Voir le fichier

@@ -128,4 +128,23 @@ public class ActivityController extends BaseController {
128 128
         return responseBean;
129 129
     }
130 130
 
131
+    @ApiOperation(value = "删除 活动报名人", notes = "删除 活动报名人")
132
+    @ApiImplicitParams({
133
+//            @ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "X-Auth-Token", value = "Token"),
134
+            @ApiImplicitParam(paramType = "path", dataTypeClass = Integer.class, name = "id", value = "编号id"),
135
+            @ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "Login-Type", value = "值为 web"),
136
+            @ApiImplicitParam(paramType = "query", dataTypeClass = Boolean.class, name = "sendSMS", value = "true表示发送短信;false表示不发送短信"),
137
+    })
138
+    @RequestMapping(value = "/signUp/{id}", method = RequestMethod.DELETE)
139
+    public ResponseBean deleteSignUp(@PathVariable("id") Integer id,
140
+                                     @RequestParam("sendSMS") Boolean sendSMS,
141
+                                     HttpSession session) {
142
+
143
+        ResponseBean responseBean = new ResponseBean();
144
+        responseBean = iTpActivitySignUpService.deleteSignUp(id, sendSMS);
145
+        return responseBean;
146
+    }
147
+
148
+
149
+
131 150
 }

+ 9
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/ITpActivitySignUpService.java Voir le fichier

@@ -2,6 +2,7 @@ package com.community.huiju.service;
2 2
 
3 3
 import com.baomidou.mybatisplus.extension.service.IService;
4 4
 import com.community.commom.mode.ResponseBean;
5
+import com.community.commom.session.UserElement;
5 6
 import com.community.huiju.model.TpActivitySignUp;
6 7
 
7 8
 /**
@@ -21,4 +22,12 @@ public interface ITpActivitySignUpService extends IService<TpActivitySignUp> {
21 22
      */
22 23
     ResponseBean getSignUpUser(String parameter);
23 24
 
25
+    /**
26
+     * 删除 活动人员
27
+     * @param id
28
+     * @param isSend 是否发送短信
29
+     * @return
30
+     */
31
+    ResponseBean deleteSignUp(Integer id, Boolean isSend);
32
+
24 33
 }

+ 31
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/TpActivitySignUpServiceImpl.java Voir le fichier

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
6 6
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
7 7
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
8 8
 import com.community.commom.mode.ResponseBean;
9
+import com.community.commom.session.UserElement;
9 10
 import com.community.commom.utils.BeanTools;
10 11
 import com.community.huiju.dao.*;
11 12
 import com.community.huiju.model.*;
@@ -14,6 +15,7 @@ import com.community.huiju.vo.ActivitySignUpVO;
14 15
 import com.google.common.collect.Maps;
15 16
 import org.springframework.beans.factory.annotation.Autowired;
16 17
 import org.springframework.stereotype.Service;
18
+import org.springframework.transaction.annotation.Transactional;
17 19
 
18 20
 import java.util.List;
19 21
 import java.util.Map;
@@ -99,4 +101,33 @@ public class TpActivitySignUpServiceImpl extends ServiceImpl<TpActivitySignUpMap
99 101
         responseBean.addSuccess(map);
100 102
         return responseBean;
101 103
     }
104
+
105
+    @Override
106
+    @Transactional(rollbackFor = Exception.class)
107
+    public ResponseBean deleteSignUp(Integer id, Boolean isSend) {
108
+        ResponseBean responseBean = new ResponseBean();
109
+
110
+        TpActivitySignUp tpActivitySignUp = tpActivitySignUpMapper.selectById(id);
111
+        if (null == tpActivitySignUp) {
112
+            responseBean.addError("该记录不存在!");
113
+            return responseBean;
114
+        }
115
+
116
+        TaUser taUser = taUserMapper.selectByPrimaryKey(tpActivitySignUp.getTaUserId());
117
+        if (null == taUser) {
118
+            responseBean.addError("APP端 用户不存在!");
119
+            return responseBean;
120
+        }
121
+
122
+        tpActivitySignUpMapper.deleteById(tpActivitySignUp);
123
+
124
+        // 发送短信
125
+        // TODO 删除成功后, 发送短信通知用户
126
+        if (isSend) {
127
+            // 开始发送
128
+        }
129
+
130
+        responseBean.addSuccess("操作成功!");
131
+        return responseBean;
132
+    }
102 133
 }

+ 2
- 1
CODE/smart-community/zuul/src/main/java/com/community/huiju/constant/Status.java Voir le fichier

@@ -17,7 +17,8 @@ public enum Status {
17 17
 
18 18
     RESPONSE_STATUS_802("802","身份凭证不存在!"),
19 19
 
20
-    RESPONSE_STATUS_803("803","Token已过期!"),
20
+    // Token 已过期!
21
+    RESPONSE_STATUS_803("803","您长时间未登录,需要重新登录。"),
21 22
     /** 状态码 end **/
22 23
 
23 24
     ;

+ 1
- 1
CODE/smart-community/zuul/src/main/java/com/community/huiju/dao/TaUserMapper.java Voir le fichier

@@ -28,7 +28,7 @@ public interface TaUserMapper {
28 28
     TaUser selectByLoginNameAndByLoginPassword(Map<String, Object> map);
29 29
 
30 30
     /**
31
-     * 根据loginName 查询用户
31
+     * 根据loginName 和 小区id 查询用户
32 32
      * @param map
33 33
      * @return 用户
34 34
      */

+ 6
- 2
CODE/smart-community/zuul/src/main/java/com/community/huiju/filter/DomainZuulPostFilter.java Voir le fichier

@@ -9,6 +9,7 @@ import com.community.huiju.constant.Status;
9 9
 import com.netflix.zuul.ZuulFilter;
10 10
 import com.netflix.zuul.context.RequestContext;
11 11
 import com.netflix.zuul.exception.ZuulException;
12
+import lombok.extern.slf4j.Slf4j;
12 13
 import org.apache.commons.lang.StringUtils;
13 14
 import org.springframework.http.HttpMethod;
14 15
 import org.springframework.http.MediaType;
@@ -22,6 +23,7 @@ import javax.servlet.http.HttpServletResponse;
22 23
  * @author weiximei
23 24
  */
24 25
 @Component
26
+@Slf4j
25 27
 public class DomainZuulPostFilter extends ZuulFilter {
26 28
 
27 29
     @Override
@@ -49,18 +51,20 @@ public class DomainZuulPostFilter extends ZuulFilter {
49 51
 
50 52
         RequestContext ctx = RequestContext.getCurrentContext();
51 53
         HttpServletResponse response = ctx.getResponse();
54
+        response.setContentType("application/json;charset=UTF-8");
52 55
         HttpServletRequest request = ctx.getRequest();
53 56
         String token = request.getHeader(Header.REQUEST_X_AUTH_TOKEN.getValue());
54 57
         String loginType = request.getHeader(Header.LOGIN_TYPE.getValue());
55 58
         if (StringUtils.isBlank(token)) {
56 59
 
57 60
         }else {
61
+            log.info("获取的token: {}", token);
58 62
             ResponseBean responseBean = new ResponseBean();
59 63
             // APP 端
60 64
             if (Constant.APP_LOGIN_TYPE.equals(loginType.trim())){
61 65
                 UserElement appElement = (UserElement) request.getSession().getAttribute(Constant.APP_USER_SESSION);
62 66
                 if (null == appElement) {
63
-                    responseBean.addError("803","Token已过期!");
67
+                    responseBean.addError(Status.RESPONSE_STATUS_803.getValue(),Status.RESPONSE_STATUS_803.getComment());
64 68
                     ctx.setResponseBody(JSONObject.toJSONString(responseBean));
65 69
                 }
66 70
 
@@ -68,7 +72,7 @@ public class DomainZuulPostFilter extends ZuulFilter {
68 72
             } else {
69 73
                 UserElement webOperateElement = (UserElement) request.getSession().getAttribute(Constant.WEB_USER_SESSION);
70 74
                 if (null == webOperateElement) {
71
-                    responseBean.addError("803","Token已过期!");
75
+                    responseBean.addError(Status.RESPONSE_STATUS_803.getValue(),Status.RESPONSE_STATUS_803.getComment());
72 76
                     ctx.setResponseBody(JSONObject.toJSONString(responseBean));
73 77
                 }
74 78
             }

+ 11
- 0
VUECODE/smart-property-manage/src/api/activity.js Voir le fichier

@@ -82,3 +82,14 @@ export function getSignUp(data) {
82 82
     }
83 83
   })
84 84
 }
85
+
86
+// 删除活动报名人
87
+export function deleteSignUp(data) {
88
+  return request({
89
+    url: '/signUp/' + data.deleteId,
90
+    method: 'delete',
91
+    param: {
92
+      sendSMS: data.sendSMS
93
+    }
94
+  })
95
+}

+ 10
- 1
VUECODE/smart-property-manage/src/store/modules/activity.js Voir le fichier

@@ -1,4 +1,4 @@
1
-import { activityList, addActivity, updateActivity, activityById, invalidActivity, getSignUp } from '@/api/activity'
1
+import { activityList, addActivity, updateActivity, activityById, invalidActivity, getSignUp, deleteSignUp } from '@/api/activity'
2 2
 
3 3
 const activityInfo = {
4 4
   state: {
@@ -59,6 +59,15 @@ const activityInfo = {
59 59
           reject(error)
60 60
         })
61 61
       })
62
+    },
63
+    DeleteSignUp({ commit, state }, data) { // 删除 活动报名人员
64
+      return new Promise((resolve, reject) => {
65
+        deleteSignUp(data).then(response => {
66
+          resolve(response)
67
+        }).catch(error => {
68
+          reject(error)
69
+        })
70
+      })
62 71
     }
63 72
 
64 73
   }

+ 31
- 29
VUECODE/smart-property-manage/src/views/social/signUp/index.vue Voir le fichier

@@ -83,6 +83,19 @@
83 83
     <el-dialog :visible.sync="dialogTableVisible" title="收货地址">
84 84
       <div>{{ dialogContent }}</div>
85 85
     </el-dialog>
86
+    <el-dialog
87
+      :visible.sync="dialogSMSVisible"
88
+      title="提示"
89
+      width="30%">
90
+      <div style="width: 400px;height: 100px;margin-left: auto;margin-right: auto; margin-top: 10px;align-content: center;">
91
+        <span>确定要删除此人报名吗?</span>
92
+        <p><el-checkbox v-model="deleteData.sendSMS">发送短信通知报名人已取消他的报名</el-checkbox></p>
93
+      </div>
94
+      <span slot="footer" class="dialog-footer">
95
+        <el-button @click="dialogSMSVisible = false">取 消</el-button>
96
+        <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
97
+      </span>
98
+    </el-dialog>
86 99
   </div>
87 100
 </template>
88 101
 <script>
@@ -96,12 +109,16 @@ export default {
96 109
         pageNum: 1,
97 110
         pageSize: 10
98 111
       },
112
+      deleteData: {
113
+        deleteId: '', // 需要删除的id
114
+        sendSMS: false // 是否发生短信
115
+      },
99 116
       total: 0, // 数据总数
100 117
       list: [],
101 118
       listLoading: true, // 表格加载框
102 119
       dialogTableVisible: false, // 是否显示弹框
103 120
       dialogContent: '提示信息', // 弹框内容
104
-      sendSMS: false // 是否发生短信
121
+      dialogSMSVisible: false // 是否删除报名弹框
105 122
     }
106 123
   },
107 124
   mounted() {
@@ -185,36 +202,21 @@ export default {
185 202
       this.dialogTableVisible = true
186 203
     },
187 204
     deleteSignUp(id) {
188
-      const h = this.$createElement
189
-      this.sendSMS = false // 默认不发送
205
+      this.dialogSMSVisible = true
206
+      this.deleteData.sendSMS = false // 默认不发送
207
+      this.deleteData.deleteId = id
208
+    },
209
+    deleteById() {
210
+      // 发送请求
211
+      this.$store.dispatch('DeleteSignUp', this.deleteData).then((res) => {
190 212
 
191
-      this.$msgbox({
192
-        title: '删除确认',
193
-        message: h('div', { style: 'width: 400px;height: 100px;line-height: 50px;align-content: center;' }, [
194
-          h('span', null, '确定要删除此人报名吗?'),
195
-          h('p', { style: 'color: teal' }, [
196
-            h('el-checkbox', { vModel: this.sendSMS }, '发送短信通知报名人已取消他的报名')
197
-          ])
198
-        ]),
199
-        showCancelButton: true,
200
-        confirmButtonText: '确定',
201
-        cancelButtonText: '取消',
202
-        beforeClose: (action, instance, done) => {
203
-          if (action === 'confirm') {
204
-            instance.confirmButtonLoading = true
205
-            // 发送
206
-            console.log(this.sendSMS)
207
-            done()
208
-          } else {
209
-            done()
210
-          }
211
-        }
212
-      }).then(action => {
213
-        this.$message({
214
-          type: 'info',
215
-          message: 'action: ' + action
216
-        })
213
+      }).catch(() => {
214
+        console.log('error DeleteSignUp')
217 215
       })
216
+
217
+      this.deleteData.deleteId = ''
218
+      // 获取密码
219
+      this.signUpList()
218 220
     }
219 221
   }
220 222
 }