Browse Source

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

weiximei 6 years ago
parent
commit
52fe4f6a77

+ 1
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TaUserServiceImpl.java View File

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

+ 1
- 1
CODE/smart-community/app-api/src/main/resources/mapper/TaUserMapper.xml View File

303
     select
303
     select
304
     <include refid="Base_Column_List" />
304
     <include refid="Base_Column_List" />
305
     from ta_user
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
   </select>
307
   </select>
308
 
308
 
309
   <select id="updateLongName" parameterType="com.community.huiju.model.TaUser" resultMap="BaseResultMap">
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 View File

128
         return responseBean;
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 View File

2
 
2
 
3
 import com.baomidou.mybatisplus.extension.service.IService;
3
 import com.baomidou.mybatisplus.extension.service.IService;
4
 import com.community.commom.mode.ResponseBean;
4
 import com.community.commom.mode.ResponseBean;
5
+import com.community.commom.session.UserElement;
5
 import com.community.huiju.model.TpActivitySignUp;
6
 import com.community.huiju.model.TpActivitySignUp;
6
 
7
 
7
 /**
8
 /**
21
      */
22
      */
22
     ResponseBean getSignUpUser(String parameter);
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 View File

6
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
7
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
8
 import com.community.commom.mode.ResponseBean;
8
 import com.community.commom.mode.ResponseBean;
9
+import com.community.commom.session.UserElement;
9
 import com.community.commom.utils.BeanTools;
10
 import com.community.commom.utils.BeanTools;
10
 import com.community.huiju.dao.*;
11
 import com.community.huiju.dao.*;
11
 import com.community.huiju.model.*;
12
 import com.community.huiju.model.*;
14
 import com.google.common.collect.Maps;
15
 import com.google.common.collect.Maps;
15
 import org.springframework.beans.factory.annotation.Autowired;
16
 import org.springframework.beans.factory.annotation.Autowired;
16
 import org.springframework.stereotype.Service;
17
 import org.springframework.stereotype.Service;
18
+import org.springframework.transaction.annotation.Transactional;
17
 
19
 
18
 import java.util.List;
20
 import java.util.List;
19
 import java.util.Map;
21
 import java.util.Map;
99
         responseBean.addSuccess(map);
101
         responseBean.addSuccess(map);
100
         return responseBean;
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 View File

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

+ 1
- 1
CODE/smart-community/zuul/src/main/java/com/community/huiju/dao/TaUserMapper.java View File

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

+ 6
- 2
CODE/smart-community/zuul/src/main/java/com/community/huiju/filter/DomainZuulPostFilter.java View File

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

+ 11
- 0
VUECODE/smart-property-manage/src/api/activity.js View File

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 View File

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
 const activityInfo = {
3
 const activityInfo = {
4
   state: {
4
   state: {
59
           reject(error)
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 View File

83
     <el-dialog :visible.sync="dialogTableVisible" title="收货地址">
83
     <el-dialog :visible.sync="dialogTableVisible" title="收货地址">
84
       <div>{{ dialogContent }}</div>
84
       <div>{{ dialogContent }}</div>
85
     </el-dialog>
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
   </div>
99
   </div>
87
 </template>
100
 </template>
88
 <script>
101
 <script>
96
         pageNum: 1,
109
         pageNum: 1,
97
         pageSize: 10
110
         pageSize: 10
98
       },
111
       },
112
+      deleteData: {
113
+        deleteId: '', // 需要删除的id
114
+        sendSMS: false // 是否发生短信
115
+      },
99
       total: 0, // 数据总数
116
       total: 0, // 数据总数
100
       list: [],
117
       list: [],
101
       listLoading: true, // 表格加载框
118
       listLoading: true, // 表格加载框
102
       dialogTableVisible: false, // 是否显示弹框
119
       dialogTableVisible: false, // 是否显示弹框
103
       dialogContent: '提示信息', // 弹框内容
120
       dialogContent: '提示信息', // 弹框内容
104
-      sendSMS: false // 是否发生短信
121
+      dialogSMSVisible: false // 是否删除报名弹框
105
     }
122
     }
106
   },
123
   },
107
   mounted() {
124
   mounted() {
185
       this.dialogTableVisible = true
202
       this.dialogTableVisible = true
186
     },
203
     },
187
     deleteSignUp(id) {
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
 }