Explorar el Código

提交 修复 缴费bug

魏熙美 hace 6 años
padre
commit
1290ff7cd2

+ 1
- 2
CODE/foreign-service/src/main/java/com/community/huiju/common/base/ResponseBean.java Ver fichero

@@ -18,10 +18,9 @@ public class ResponseBean<T> implements Serializable {
18 18
     public ResponseBean() {
19 19
     }
20 20
 
21
-    public void addError(Integer code, String message, T data) {
21
+    public void addError(Integer code, String message) {
22 22
         this.code = code;
23 23
         this.message = message;
24
-        this.data = data;
25 24
     }
26 25
 
27 26
     public void addSuccess(String message) {

+ 0
- 11
CODE/foreign-service/src/main/java/com/community/huiju/enums/ErroMessage.java Ver fichero

@@ -1,11 +0,0 @@
1
-package com.community.huiju.enums;
2
-
3
-/**
4
- * 错误消息定义
5
- * @author weiximei
6
- */
7
-public enum ErroMessage {
8
-
9
-
10
-
11
-}

+ 50
- 0
CODE/foreign-service/src/main/java/com/community/huiju/enums/ResponseErrorsMessages.java Ver fichero

@@ -0,0 +1,50 @@
1
+package com.community.huiju.enums;
2
+
3
+/**
4
+ * 错误消息定义
5
+ * @author weiximei
6
+ */
7
+public enum ResponseErrorsMessages {
8
+
9
+    SYSTEM_ERRORS (500, "服务断网了!"),
10
+    NOT_PHONE(1000, "请输入正确的手机号!"),
11
+    NOT_USER_NAME(1001, "用户名不能为空!"),
12
+    ;
13
+
14
+
15
+    ResponseErrorsMessages(Integer code, String msg) {
16
+        this.code = code;
17
+        this.msg = msg;
18
+    }
19
+
20
+
21
+    private Integer code;
22
+
23
+    private String msg;
24
+
25
+    public Integer getCode() {
26
+        return code;
27
+    }
28
+
29
+    public void setCode(Integer code) {
30
+        this.code = code;
31
+    }
32
+
33
+    public String getMsg() {
34
+        return msg;
35
+    }
36
+
37
+    public void setMsg(String msg) {
38
+        this.msg = msg;
39
+    }
40
+
41
+    @Override
42
+    public String toString() {
43
+        return "ResponseErrorsMessages{" +
44
+                "code=" + code +
45
+                ", msg='" + msg + '\'' +
46
+                '}';
47
+    }
48
+
49
+
50
+}

+ 4
- 27
CODE/foreign-service/src/main/java/com/community/huiju/exception/ExceptionHandleAdice.java Ver fichero

@@ -1,7 +1,8 @@
1 1
 package com.community.huiju.exception;
2 2
 
3 3
 import com.community.commom.constant.Constant;
4
-import com.community.commom.mode.ResponseBean;
4
+import com.community.huiju.common.base.ResponseBean;
5
+import com.community.huiju.enums.ResponseErrorsMessages;
5 6
 import lombok.extern.slf4j.Slf4j;
6 7
 import org.springframework.validation.ObjectError;
7 8
 import org.springframework.web.bind.MethodArgumentNotValidException;
@@ -25,15 +26,7 @@ public class ExceptionHandleAdice {
25 26
     public ResponseBean handleException(Exception e){
26 27
         log.error(e.getMessage(),e);
27 28
         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());
29
+        response.addError(ResponseErrorsMessages.SYSTEM_ERRORS.getCode(),ResponseErrorsMessages.SYSTEM_ERRORS.getMsg());
37 30
         return response;
38 31
     }
39 32
 
@@ -42,23 +35,7 @@ public class ExceptionHandleAdice {
42 35
     public ResponseBean handleException(WisdomException e) {
43 36
         log.error(e.getMessage(),e);
44 37
         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
-
38
+        response.addError(e.getCode(),e.getMessage());
62 39
         return response;
63 40
     }
64 41
 

+ 18
- 0
CODE/foreign-service/src/main/java/com/community/huiju/exception/WisdomException.java Ver fichero

@@ -1,16 +1,34 @@
1 1
 package com.community.huiju.exception;
2 2
 
3 3
 
4
+import lombok.Data;
5
+
4 6
 /**
5 7
  * @author weiximei
6 8
  */
9
+@Data
7 10
 public class WisdomException extends RuntimeException {
8 11
 
12
+    private String mes;
13
+
14
+    private Integer code;
9 15
 
10 16
     public WisdomException(String msg, Throwable t) {
11 17
         super(msg, t);
12 18
     }
13 19
 
20
+    public WisdomException(Integer code,String msg, Throwable t) {
21
+        super(msg, t);
22
+        this.mes = msg;
23
+        this.code = code;
24
+    }
25
+
26
+    public WisdomException(Integer code,String msg) {
27
+        super(msg);
28
+        this.mes = msg;
29
+        this.code = code;
30
+    }
31
+
14 32
     public WisdomException(String msg) {
15 33
         super(msg);
16 34
     }

+ 20
- 0
CODE/foreign-service/src/main/java/com/community/huiju/service/ITaUserService.java Ver fichero

@@ -1,8 +1,14 @@
1 1
 package com.community.huiju.service;
2 2
 
3 3
 import com.baomidou.mybatisplus.extension.service.IService;
4
+import com.community.commom.utils.AccountValidatorUtil;
4 5
 import com.community.huiju.common.base.ResponseBean;
6
+import com.community.huiju.enums.ResponseErrorsMessages;
7
+import com.community.huiju.exception.WisdomException;
5 8
 import com.community.huiju.model.TaUser;
9
+import lombok.extern.slf4j.Slf4j;
10
+import org.slf4j.Logger;
11
+import org.slf4j.LoggerFactory;
6 12
 
7 13
 /**
8 14
  * <p>
@@ -14,6 +20,20 @@ import com.community.huiju.model.TaUser;
14 20
  */
15 21
 public interface ITaUserService extends IService<TaUser> {
16 22
 
23
+    Logger log = LoggerFactory.getLogger(ITaUserService.class);
24
+
25
+    /**
26
+     * 检验手机号
27
+     * @param phone
28
+     */
29
+    default void checkPhone(String phone) {
30
+        log.info("{} 手机号校验结果: {}",phone, AccountValidatorUtil.isPhone(phone));
31
+        if (!AccountValidatorUtil.isPhone(phone)){
32
+            throw new WisdomException(ResponseErrorsMessages.NOT_PHONE.getCode(), ResponseErrorsMessages.NOT_PHONE.getMsg());
33
+        }
34
+    }
35
+
36
+
17 37
     /**
18 38
      * 添加用户
19 39
      * @param userName

+ 4
- 1
CODE/foreign-service/src/main/java/com/community/huiju/service/impl/TaUserServiceImpl.java Ver fichero

@@ -21,6 +21,10 @@ public class TaUserServiceImpl extends ServiceImpl<TaUserMapper, TaUser> impleme
21 21
     @Override
22 22
     public ResponseBean addTaUser(String userName, String idCard, String gender, String phone) {
23 23
         ResponseBean responseBean = new ResponseBean();
24
+
25
+        // 校验手机号 -> 是否重复
26
+        checkPhone(phone);
27
+
24 28
         TaUser taUser = new TaUser();
25 29
         taUser.setUserName(userName);
26 30
         taUser.setIdCard(idCard);
@@ -30,7 +34,6 @@ public class TaUserServiceImpl extends ServiceImpl<TaUserMapper, TaUser> impleme
30 34
         if (saveBool) {
31 35
             responseBean.addSuccess(taUser);
32 36
         }
33
-
34 37
         return responseBean;
35 38
     }
36 39
 }

+ 2
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/WxPayServiceImpl.java Ver fichero

@@ -371,7 +371,7 @@ public class WxPayServiceImpl implements WxPayServiceI {
371 371
 				// 校验是否,超出缴费有效期时间
372 372
 				LocalDateTime expireDateLocalDateTime = LocalDateTime.ofInstant(taUserLicense.getExpireDate().toInstant(), ZoneId.systemDefault());
373 373
 				expireDateLocalDateTime.plusDays(taUserLicense.getRenewTime());
374
-				if (System.currentTimeMillis() > expireDateLocalDateTime.toEpochSecond(ZoneOffset.of("+8"))) {
374
+				if (taUserLicense.getRenewTime().intValue() > 0 && System.currentTimeMillis() > expireDateLocalDateTime.toEpochSecond(ZoneOffset.of("+8"))) {
375 375
 					throw new WisdomException("已超出续费时间,请找物业处理!");
376 376
 				}
377 377
 
@@ -497,6 +497,7 @@ public class WxPayServiceImpl implements WxPayServiceI {
497 497
 			}
498 498
 
499 499
 			e.setExpireDate(taUserLicense.getExpireDate());
500
+			e.setPaymentType(pay_type);
500 501
 
501 502
 			taUserLicenseOrderMapper.updateByPrimaryKeySelective(e);
502 503
 

+ 1
- 1
CODE/smart-community/property-api/src/main/java/com/community/huiju/controller/TaSysMenuController.java Ver fichero

@@ -63,7 +63,7 @@ public class TaSysMenuController extends BaseController {
63 63
 
64 64
 		// 判断是否启动了 8 个菜单
65 65
 		QueryWrapper<TaSysMenu> sysMenuQueryWrapper = new QueryWrapper<>();
66
-		sysMenuQueryWrapper.eq("status", "1");
66
+		sysMenuQueryWrapper.eq("status", "0");
67 67
 		sysMenuQueryWrapper.eq("community_id", userElement.getCommunityId());
68 68
 		int count = taSysMenuService.count(sysMenuQueryWrapper);
69 69
 		if (count >= 8) {

+ 6
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/model/TaSysMenu.java Ver fichero

@@ -1,5 +1,6 @@
1 1
 package com.community.huiju.model;
2 2
 
3
+import com.baomidou.mybatisplus.annotation.TableField;
3 4
 import lombok.Data;
4 5
 import lombok.EqualsAndHashCode;
5 6
 import lombok.experimental.Accessors;
@@ -68,5 +69,10 @@ public class TaSysMenu implements Serializable {
68 69
      */
69 70
     private String explain;
70 71
 
72
+    /**
73
+     * 菜单图标
74
+     */
75
+    @TableField(exist = false)
76
+    private String imgUrl;
71 77
 
72 78
 }

+ 13
- 12
CODE/smart-community/property-api/src/main/resources/mapper/TaSysMenuMapper.xml Ver fichero

@@ -4,20 +4,21 @@
4 4
 
5 5
     <select id="selectList" parameterType="integer" resultType="com.community.huiju.model.TaSysMenu" >
6 6
         SELECT
7
-            id,
8
-            community_id,
9
-            menu_name,
10
-            menu_url,
11
-            parent_id,
12
-            sort,
13
-            menu_type,
14
-            status,
15
-            remark,
16
-            `explain`
7
+            tas.id,
8
+            tas.community_id,
9
+            tas.menu_name,
10
+            tas.menu_url,
11
+            tas.parent_id,
12
+            tas.sort,
13
+            tas.menu_type,
14
+            tas.status,
15
+            tas.remark,
16
+            tas.`explain`,
17
+            (select menu_icon_img from ta_sys_menu_img where ta_menu_id = tas.id limit 0,1) imgUrl
17 18
         FROM
18
-            ta_sys_menu
19
+            ta_sys_menu tas
19 20
         WHERE
20
-            community_id = #{communityId}
21
+            tas.community_id = #{communityId}
21 22
     </select>
22 23
 
23 24
 </mapper>

+ 1
- 1
VUECODE/smart-property-manage/src/views/systemResources/app/index.vue Ver fichero

@@ -39,7 +39,7 @@
39 39
             align="center"
40 40
             label="图标">
41 41
             <template slot-scope="scope">
42
-              <img :src="scope.row.menuUrl" width="50" height="50">
42
+              <img :src="scope.row.imgUrl" width="50" height="50">
43 43
             </template>
44 44
           </el-table-column>
45 45
           <el-table-column