weiximei 6 년 전
부모
커밋
bd212bbe2f

+ 66
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/exception/ExceptionHandleAdice.java 파일 보기

@@ -0,0 +1,66 @@
1
+package com.community.huiju.exception;
2
+
3
+import com.community.commom.constant.Constant;
4
+import com.community.commom.mode.ResponseBean;
5
+import lombok.extern.slf4j.Slf4j;
6
+import org.springframework.validation.ObjectError;
7
+import org.springframework.web.bind.MethodArgumentNotValidException;
8
+import org.springframework.web.bind.annotation.ControllerAdvice;
9
+import org.springframework.web.bind.annotation.ExceptionHandler;
10
+import org.springframework.web.bind.annotation.ResponseBody;
11
+
12
+import java.util.List;
13
+
14
+/**
15
+ * 统一异常出口
16
+ * @author weiximei
17
+ */
18
+@ControllerAdvice
19
+@ResponseBody
20
+@Slf4j
21
+public class ExceptionHandleAdice {
22
+
23
+
24
+    @ExceptionHandler(Exception.class)
25
+    public ResponseBean handleException(Exception e){
26
+        log.error(e.getMessage(),e);
27
+        ResponseBean response = new ResponseBean();
28
+        response.addError(Constant.REQUEST_ERROR,"系统异常,请稍后重试!");
29
+        return response;
30
+    }
31
+
32
+    @ExceptionHandler(RuntimeException.class)
33
+    public ResponseBean handleException(RuntimeException e){
34
+        log.error(e.getMessage(),e);
35
+        ResponseBean response = new ResponseBean();
36
+        response.addError(e.getMessage());
37
+        return response;
38
+    }
39
+
40
+
41
+    @ExceptionHandler(WisdomException.class)
42
+    public ResponseBean handleException(WisdomException e) {
43
+        log.error(e.getMessage(),e);
44
+        ResponseBean response = new ResponseBean();
45
+        response.addError(e.getMessage());
46
+        return response;
47
+    }
48
+
49
+
50
+    @ExceptionHandler(MethodArgumentNotValidException.class)
51
+    public ResponseBean handlelllewgalParamException(MethodArgumentNotValidException e){
52
+        ResponseBean response = new ResponseBean();
53
+
54
+        List<ObjectError> errors  =e.getBindingResult().getAllErrors();
55
+        String message = "参数不合法";
56
+        if (errors.size() >0) {
57
+            message = errors.get(0).getDefaultMessage();
58
+        }
59
+
60
+        response.addError(message);
61
+
62
+        return response;
63
+    }
64
+
65
+
66
+}

+ 17
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/exception/WisdomException.java 파일 보기

@@ -0,0 +1,17 @@
1
+package com.community.huiju.exception;
2
+
3
+
4
+/**
5
+ * @author weiximei
6
+ */
7
+public class WisdomException extends RuntimeException {
8
+
9
+
10
+    public WisdomException(String msg, Throwable t) {
11
+        super(msg, t);
12
+    }
13
+
14
+    public WisdomException(String msg) {
15
+        super(msg);
16
+    }
17
+}

+ 3
- 3
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TicketServiceImpl.java 파일 보기

@@ -140,9 +140,9 @@ public class TicketServiceImpl implements ITicketService {
140 140
                     "房屋质量":"2".equals(repairType)?
141 141
                     "户内设施":null;
142 142
             tpTicketVO.setRepairName(repairName);
143
-            tpTicketVO.setStatus(recordList.get(0).getStatus());
144
-            tpTicketVO.setTicketStatusName(recordList.get(0).getTicketStatusName());
145
-            tpTicketVO.setTicketRecordDate(recordList.get(0).getCreateDate());
143
+            tpTicketVO.setStatus(recordList.get(recordList.size()-1).getStatus());
144
+            tpTicketVO.setTicketStatusName(recordList.get(recordList.size()-1).getTicketStatusName());
145
+            tpTicketVO.setTicketRecordDate(recordList.get(recordList.size()-1).getCreateDate());
146 146
             if (null != comment) {
147 147
                 tpTicketVO.setCommentContent(comment.getContent());
148 148
                 tpTicketVO.setCommentCreateDate(comment.getCreateDate());

+ 1
- 1
VUECODE/smart-operate-manage/src/views/banner/addBanner/index.vue 파일 보기

@@ -22,7 +22,7 @@
22 22
       <el-form-item :label-width="formLabelWidth" label="banner图">
23 23
         <el-upload
24 24
           class="avatar-uploader"
25
-          action="http://localhost:8085/operate-api/uploadimage"
25
+          action="http://101.132.102.231:8085/operate-api/uploadimage"
26 26
           name="uploadFiles"
27 27
           :show-file-list="false"
28 28
           :on-success="handleAvatarSuccess">

+ 1
- 1
VUECODE/smart-operate-manage/src/views/banner/ediBanner/index.vue 파일 보기

@@ -22,7 +22,7 @@
22 22
       <el-form-item :label-width="formLabelWidth" label="banner图">
23 23
         <el-upload
24 24
           class="avatar-uploader"
25
-          action="http://localhost:8085/operate-api/uploadimage"
25
+          action="http://101.132.102.231:8085/operate-api/uploadimage"
26 26
           name="uploadFiles"
27 27
           :show-file-list="false"
28 28
           :on-success="handleAvatarSuccess">