优化了shoptype定义,修改bug
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/annotation/ShopType.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/annotation/ShopType.java
index d869ffe..4c16761 100644
--- a/payapi-common/src/main/java/com/supwisdom/dlpay/api/annotation/ShopType.java
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/annotation/ShopType.java
@@ -1,5 +1,7 @@
 package com.supwisdom.dlpay.api.annotation;
 
+import com.supwisdom.dlpay.api.util.SexTypes;
+import com.supwisdom.dlpay.api.util.ShopTypes;
 import com.supwisdom.dlpay.api.validator.ShopTypeValidator;
 
 import javax.validation.Constraint;
@@ -12,9 +14,11 @@
 @Target({ElementType.ANNOTATION_TYPE, ElementType.METHOD, ElementType.FIELD})
 @Retention(RetentionPolicy.RUNTIME)
 public @interface ShopType {
-  String message() default "不正确的状态 , 应该是 '1', '2' 其中之一";
+  String message() default "不正确的商户类型 ";
 
   Class<?>[] groups() default {};
 
   Class<? extends Payload>[] payload() default {};
+
+  ShopTypes value() default ShopTypes.ALL;
 }
\ No newline at end of file
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/OpenShopParam.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/OpenShopParam.java
index 3be30ad..df8ba1e 100644
--- a/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/OpenShopParam.java
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/bean/OpenShopParam.java
@@ -22,9 +22,9 @@
   @NotEmpty(message = "商户唯一号不能为空")
   private String shopUniqueId;
   @Sign
-  @NotNull(message = "商户类型不能为空")
   @ShopType
-  private Integer shoptype;
+  @NotNull(message = "商户类型不能为空")
+  private  String shoptype;
   @Sign
   private Integer fshopid;
   @Sign
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/util/ShopTypes.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/util/ShopTypes.java
new file mode 100644
index 0000000..3503ab0
--- /dev/null
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/util/ShopTypes.java
@@ -0,0 +1,34 @@
+package com.supwisdom.dlpay.api.util;
+
+public enum ShopTypes {
+  GROUP("group", "商户组"),
+  ROOT("root", "根商户"),
+  NORMAL("normal", "结算商户"),
+  ALL("all", new ShopTypes[]{ROOT, GROUP, NORMAL});
+
+  ShopTypes(String t, Object data) {
+    this.id = t;
+    this.data = data;
+  }
+
+  public String value() {
+    return this.id;
+  }
+
+  public Object data() {
+    return this.data;
+  }
+
+  public String desc() {
+    return this.data.toString();
+  }
+
+
+  public String id;
+  public Object data;
+
+  @Override
+  public String toString() {
+    return this.id;
+  }
+}
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/validator/MobileNumberValidator.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/validator/MobileNumberValidator.java
index 8fc1a26..4ded93f 100644
--- a/payapi-common/src/main/java/com/supwisdom/dlpay/api/validator/MobileNumberValidator.java
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/validator/MobileNumberValidator.java
@@ -2,6 +2,7 @@
 
 import com.supwisdom.dlpay.api.annotation.MobileNumber;
 import com.supwisdom.dlpay.api.util.MobileNumberCheck;
+import org.apache.commons.lang3.StringUtils;
 
 import javax.validation.ConstraintValidator;
 import javax.validation.ConstraintValidatorContext;
@@ -10,7 +11,7 @@
 
   @Override
   public boolean isValid(String value, ConstraintValidatorContext context) {
-    if (value == null) {
+    if (value == null || StringUtils.isEmpty(value)) {
       return true;
     }
     return MobileNumberCheck.isPhone(value);
diff --git a/payapi-common/src/main/java/com/supwisdom/dlpay/api/validator/ShopTypeValidator.java b/payapi-common/src/main/java/com/supwisdom/dlpay/api/validator/ShopTypeValidator.java
index cdb3491..bcd7e96 100644
--- a/payapi-common/src/main/java/com/supwisdom/dlpay/api/validator/ShopTypeValidator.java
+++ b/payapi-common/src/main/java/com/supwisdom/dlpay/api/validator/ShopTypeValidator.java
@@ -1,20 +1,33 @@
 package com.supwisdom.dlpay.api.validator;
 
 import com.supwisdom.dlpay.api.annotation.ShopType;
+import com.supwisdom.dlpay.api.util.ShopTypes;
 
 import javax.validation.ConstraintValidator;
 import javax.validation.ConstraintValidatorContext;
-import java.util.Collections;
+import java.util.Arrays;
 
-public class ShopTypeValidator implements ConstraintValidator<ShopType, Integer> {
-  private final int[] ALL_TYPE = {1, 2};
+public class ShopTypeValidator implements ConstraintValidator<ShopType, String> {
+  private String[] allTypes;
 
   @Override
-  public boolean isValid(Integer value, ConstraintValidatorContext context) {
-    return Collections.singletonList(ALL_TYPE).contains(value);
+  public boolean isValid(String value, ConstraintValidatorContext context) {
+    if (value == null || value.isEmpty()) {
+      return true;
+    }
+    return Arrays.asList(allTypes).contains(value);
   }
 
   @Override
   public void initialize(ShopType constraintAnnotation) {
+    Object value = constraintAnnotation.value().data();
+    if (value instanceof ShopTypes[]) {
+      allTypes = new String[((ShopTypes[]) value).length];
+      for (int i = 0; i < ((ShopTypes[]) value).length; ++i) {
+        allTypes[i] = ((ShopTypes[]) value)[i].value();
+      }
+    } else {
+      allTypes = new String[]{value.toString()};
+    }
   }
 }
\ No newline at end of file
diff --git a/payapi/build.gradle b/payapi/build.gradle
index 18f9d7f..419a470 100644
--- a/payapi/build.gradle
+++ b/payapi/build.gradle
@@ -68,7 +68,7 @@
     implementation 'org.postgresql:postgresql:42.2.5'
     implementation 'com.fasterxml.jackson.module:jackson-module-kotlin'
     implementation 'com.jcabi:jcabi-manifests:1.1'
-    implementation 'org.bitbucket.b_c:jose4j:0.6.3'
+    implementation 'org.bitbucket.b_c:jose4j:0.6.5'
     implementation 'io.github.microutils:kotlin-logging:1.6.26'
     implementation 'org.slf4j:slf4j-parent:1.7.26'
     implementation 'com.github.penggle:kaptcha:2.3.2'
@@ -77,7 +77,7 @@
     implementation group: 'javax.servlet', name: 'jstl', version: '1.2'
     implementation group: 'taglibs', name: 'standard', version: '1.1.2'
     implementation group: 'commons-codec', name: 'commons-codec', version: '1.6'
-    implementation files('libs/ojdbc6.jar')
+//    implementation files('libs/ojdbc6.jar')
     implementation 'commons-dbcp:commons-dbcp:1.4'
 
     implementation project(':payapi-common')
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TShop.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TShop.java
index 49b5df7..74c3ba6 100644
--- a/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TShop.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TShop.java
@@ -15,13 +15,16 @@
   private Integer shopid;
 
   @Column(name = "FSHOPID", precision = 9)
+  @NotNull
   private Integer fshopid;
 
   @Column(name = "SHOPNAME", length = 200)
+  @NotNull
   private String shopname;
 
-  @Column(name = "SHOPTYPE", precision = 1)
-  private Integer shoptype;
+  @Column(name = "SHOPTYPE", length = 30)
+  @NotNull
+  private String shoptype;
 
   @Column(name = "STATUS", length = 20)
   @NotNull
@@ -73,7 +76,7 @@
   public TShop() {
   }
 
-  public TShop(Integer fshopid, String shopname, Integer shoptype, String status, String shopaccno, String contactman, String idtype, String idno, String tel, String mobile, String email, String addr, String zipcode, String opendate, String closedate, String thirdUniqueIdenty) {
+  public TShop(Integer fshopid, String shopname, String shoptype, String status, String shopaccno, String contactman, String idtype, String idno, String tel, String mobile, String email, String addr, String zipcode, String opendate, String closedate, String thirdUniqueIdenty) {
     this.fshopid = fshopid;
     this.shopname = shopname;
     this.shoptype = shoptype;
@@ -124,11 +127,11 @@
     this.shopname = shopname;
   }
 
-  public Integer getShoptype() {
+  public String getShoptype() {
     return shoptype;
   }
 
-  public void setShoptype(Integer shoptype) {
+  public void setShoptype(String shoptype) {
     this.shoptype = shoptype;
   }
 
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/framework/util/Constants.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/util/Constants.java
index 17dd6bc..46af8bb 100644
--- a/payapi/src/main/java/com/supwisdom/dlpay/framework/util/Constants.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/util/Constants.java
@@ -8,4 +8,6 @@
   public static final String JWT_CLAIM_TENANTID = "tenantId";
   public static final String JWT_CLAIM_UID = "uid";
   public static final String JWT_CLAIM_AUTHORITIES = "authorities";
+  // 根商户ID
+  public static final Integer ROOT_SHOP_FID = 1;
 }
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/system/bean/ZTreeNode.java b/payapi/src/main/java/com/supwisdom/dlpay/system/bean/ZTreeNode.java
index 61e122e..8a4c964 100644
--- a/payapi/src/main/java/com/supwisdom/dlpay/system/bean/ZTreeNode.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/system/bean/ZTreeNode.java
@@ -8,7 +8,7 @@
     private boolean checked;
     private boolean open;
 
-    private Integer shoptype; //商户类别,商户树用到
+    private String shoptype; //商户类别,商户树用到
     private String shopaccno; //商户账号
     private String iconSkin; //自定义图标
 
@@ -52,11 +52,11 @@
         this.checked = checked;
     }
 
-    public Integer getShoptype() {
+    public String getShoptype() {
         return shoptype;
     }
 
-    public void setShoptype(Integer shoptype) {
+    public void setShoptype(String shoptype) {
         this.shoptype = shoptype;
     }
 
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/system/controller/ShopController.java b/payapi/src/main/java/com/supwisdom/dlpay/system/controller/ShopController.java
index 9cc74c5..cb76283 100644
--- a/payapi/src/main/java/com/supwisdom/dlpay/system/controller/ShopController.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/system/controller/ShopController.java
@@ -4,6 +4,7 @@
 import com.supwisdom.dlpay.api.domain.TSourceType;
 import com.supwisdom.dlpay.api.domain.TShopSourceType;
 import com.supwisdom.dlpay.api.domain.TShopSourceTypeConfig;
+import com.supwisdom.dlpay.api.util.ShopTypes;
 import com.supwisdom.dlpay.framework.domain.TShop;
 import com.supwisdom.dlpay.framework.domain.TShopacc;
 import com.supwisdom.dlpay.framework.service.SystemUtilService;
@@ -13,6 +14,7 @@
 import com.supwisdom.dlpay.system.service.ParamService;
 import com.supwisdom.dlpay.system.service.ShopDataService;
 import com.supwisdom.dlpay.util.ConstantUtil;
+import com.supwisdom.dlpay.util.EnumCheck;
 import com.supwisdom.dlpay.util.WebCheckException;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -35,6 +37,8 @@
   @Autowired
   private DictionaryProxy dictionaryProxy;
 
+  private EnumCheck<ShopTypes, String> shopTypeCheck = new EnumCheck<>();
+
   @GetMapping("/shop/index")
   public String shopView() {
     return "system/shop/index";
@@ -84,7 +88,7 @@
   @PreAuthorize("hasPermission('/shop/saveorupdate','')")
   @ResponseBody
   public JsonResult saveOrUpdateShop(@RequestParam("shopid") Integer shopid, @RequestParam("shopname") String shopname,
-                                     @RequestParam("fshopid") Integer fshopid, @RequestParam("shoptype") Integer shoptype,
+                                     @RequestParam("fshopid") Integer fshopid, @RequestParam("shoptype") String shoptype,
                                      @RequestParam(value = "contactman", required = false) String contactman,
                                      @RequestParam(value = "idtype", required = false) String idtype,
                                      @RequestParam(value = "idno", required = false) String idno,
@@ -93,7 +97,8 @@
                                      @RequestParam(value = "email", required = false) String email,
                                      @RequestParam(value = "addr", required = false) String addr,
                                      @RequestParam(value = "zipcode", required = false) String zipcode) {
-    if (null == shopid || StringUtil.isEmpty(shopname) || null == fshopid || (shoptype != 0 && shoptype != 1)) {
+    if (null == shopid || StringUtil.isEmpty(shopname) || null == fshopid
+        || !shopTypeCheck.isInEnums(shoptype, ShopTypes.NORMAL, ShopTypes.GROUP)) {
       return JsonResult.error("参数传递错误");
     }
 
@@ -115,7 +120,6 @@
       }
       shop.setFshopid(fshopid);
       shop.setShopname(shopname);
-//      shop.setShoptype(shoptype); //商户类型不能改
     }
     shop.setContactman(contactman == null ? null : contactman.trim());
     shop.setIdno(idno == null ? null : idno.trim());
@@ -125,7 +129,7 @@
     } else if (!StringUtil.isEmpty(shop.getIdno()) && "1".equals(shop.getIdtype()) && !StringUtil.isIdentity(shop.getIdno())) {
       return JsonResult.error("身份证格式错误!");
     }
-    shop.setMobile(mobile == null ? null : mobile);
+    shop.setMobile(mobile);
     if (!StringUtil.isEmpty(shop.getMobile()) && !StringUtil.isMobile(shop.getMobile())) {
       return JsonResult.error("请正确填写手机号!");
     }
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/system/service/impl/SettleReportServiceImpl.java b/payapi/src/main/java/com/supwisdom/dlpay/system/service/impl/SettleReportServiceImpl.java
index dc1128f..9c0232b 100644
--- a/payapi/src/main/java/com/supwisdom/dlpay/system/service/impl/SettleReportServiceImpl.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/system/service/impl/SettleReportServiceImpl.java
@@ -1,5 +1,6 @@
 package com.supwisdom.dlpay.system.service.impl;
 
+import com.supwisdom.dlpay.api.util.ShopTypes;
 import com.supwisdom.dlpay.framework.dao.*;
 import com.supwisdom.dlpay.framework.domain.TSettlectl;
 import com.supwisdom.dlpay.framework.domain.TShop;
@@ -10,6 +11,7 @@
 import com.supwisdom.dlpay.framework.util.StringUtil;
 import com.supwisdom.dlpay.system.bean.*;
 import com.supwisdom.dlpay.system.service.SettleReportService;
+import com.supwisdom.dlpay.util.EnumCheck;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.PageRequest;
@@ -32,10 +34,12 @@
   @Autowired
   private ShopDao shopDao;
 
+  private EnumCheck<ShopTypes, String> shoptypeCheck = new EnumCheck<>();
+
   @Override
   public String getSystemSettledate() {
     TSettlectl settlectl = settleCtlDao.getOne(1);
-    if (null != settlectl && null != settlectl.getSettledate()) {
+    if (null != settlectl.getSettledate()) {
       return settlectl.getSettledate().toString();
     }
     return DateUtil.getNow("yyyyMMdd");
@@ -143,7 +147,7 @@
           TreeSelectNode node = new TreeSelectNode();
           node.setId(shop.getShopid().toString());
           node.setName(shop.getShopname());
-          node.setOpen(shop.getShoptype() == 0);
+          node.setOpen(!shoptypeCheck.isInEnums(shop.getShoptype(), ShopTypes.NORMAL));
           node.setChecked(false);
           node.setAccno(shop.getShopaccno() == null ? "" : shop.getShopaccno());
           node.setpId(String.valueOf(fshopid));
@@ -203,11 +207,11 @@
         //商户组,计算该组下所有的交易额
         long transcnt = 0;
         double transamt = 0;
-        List<TShop> childrenShops = getChildrenShopByShopid(shopAllList,shop.getShopid().intValue()); //子商户列表
+        List<TShop> childrenShops = getChildrenShopByShopid(shopAllList, shop.getShopid().intValue()); //子商户列表
         for (TShop child : childrenShops) {
-          if(!StringUtil.isEmpty(child.getShopaccno())){
-            for(ShopBusinessInfo info:businessInfos){
-              if(child.getShopaccno().equals(info.getShopaccno())){
+          if (!StringUtil.isEmpty(child.getShopaccno())) {
+            for (ShopBusinessInfo info : businessInfos) {
+              if (child.getShopaccno().equals(info.getShopaccno())) {
                 transcnt += info.getTranscnt();
                 transamt += (info.getCramt() - info.getDramt());
               }
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/system/service/impl/ShopDataServiceImpl.java b/payapi/src/main/java/com/supwisdom/dlpay/system/service/impl/ShopDataServiceImpl.java
index 24beb2b..51981fd 100644
--- a/payapi/src/main/java/com/supwisdom/dlpay/system/service/impl/ShopDataServiceImpl.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/system/service/impl/ShopDataServiceImpl.java
@@ -8,6 +8,7 @@
 import com.supwisdom.dlpay.api.domain.TSourceTypeConfig;
 import com.supwisdom.dlpay.api.domain.TShopSourceType;
 import com.supwisdom.dlpay.api.domain.TShopSourceTypeConfig;
+import com.supwisdom.dlpay.api.util.ShopTypes;
 import com.supwisdom.dlpay.framework.dao.ShopDao;
 import com.supwisdom.dlpay.framework.dao.ShopaccDao;
 import com.supwisdom.dlpay.framework.data.SystemDateTime;
@@ -15,13 +16,11 @@
 import com.supwisdom.dlpay.framework.domain.TShopacc;
 import com.supwisdom.dlpay.framework.service.SystemUtilService;
 import com.supwisdom.dlpay.framework.tenant.TenantContext;
-import com.supwisdom.dlpay.framework.util.PageResult;
-import com.supwisdom.dlpay.framework.util.StringUtil;
-import com.supwisdom.dlpay.framework.util.Subject;
-import com.supwisdom.dlpay.framework.util.TradeDict;
+import com.supwisdom.dlpay.framework.util.*;
 import com.supwisdom.dlpay.system.bean.ShopConfigBean;
 import com.supwisdom.dlpay.system.bean.ZTreeNode;
 import com.supwisdom.dlpay.system.service.ShopDataService;
+import com.supwisdom.dlpay.util.EnumCheck;
 import com.supwisdom.dlpay.util.WebCheckException;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
@@ -53,6 +52,8 @@
   @Autowired
   private ShopSourceTypeConfigDao shopPaytypeConfigDao;
 
+  private EnumCheck<ShopTypes, String> enumUtil = new EnumCheck<>();
+
   @Override
   public List<ZTreeNode> getAllShopNodes() {
     List<ZTreeNode> result = new ArrayList<>(0);
@@ -68,7 +69,8 @@
         node.setOpen(true);
         node.setShoptype(shop.getShoptype());
         node.setShopaccno(StringUtil.isEmpty(shop.getShopaccno()) ? "" : shop.getShopaccno());
-        node.setIconSkin(shop.getShoptype() == 0 ? "pIcon01" : "pIcon02");
+        node.setIconSkin(enumUtil.isInEnums(shop.getShoptype(),
+            ShopTypes.ROOT, ShopTypes.GROUP) ? "pIcon01" : "pIcon02");
         result.add(node);
       }
     }
@@ -86,6 +88,9 @@
   @Override
   public boolean deleteShop(TShop shop) throws WebCheckException {
     if (null != shop) {
+      if (ShopTypes.ROOT.value().equals(shop.getShoptype())) {
+        throw new WebCheckException("不能删除根商户节点");
+      }
       List<TShop> childShops = shopDao.getChildShopsByShopid(shop.getShopid());
       if (!StringUtil.isEmpty(childShops))
         throw new WebCheckException("请先删除下级商户");
@@ -110,7 +115,8 @@
       TShop fshop = shopDao.getTShopByShopid(shop.getFshopid());
       if (null == fshop) {
         throw new WebCheckException("上级商户不存在!");
-      } else if (fshop.getShoptype() == 1) {
+      } else if (!enumUtil.isInEnums(fshop.getShoptype(),
+          ShopTypes.ROOT, ShopTypes.GROUP)) {
         throw new WebCheckException("上级商户不是商户组!");
       }
     }
@@ -130,7 +136,7 @@
       shop.setOpendate(dt.getHostdate());
       shop.setTenantId(TenantContext.getTenantSchema());
       shopDao.save(shop);
-      if (shop.getShoptype() == 1) {
+      if (enumUtil.isInEnums(shop.getShoptype(), ShopTypes.NORMAL)) {
         TShopacc shopacc = new TShopacc();
         shopacc.setShopaccno(String.format("2%09d", shop.getShopid()));
         shopacc.setShopid(shop.getShopid());
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/util/ConstantUtil.java b/payapi/src/main/java/com/supwisdom/dlpay/util/ConstantUtil.java
index 4bd34fe..ce13e1a 100644
--- a/payapi/src/main/java/com/supwisdom/dlpay/util/ConstantUtil.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/util/ConstantUtil.java
@@ -19,9 +19,6 @@
   public static final String IDTYPE_OTHER = "9"; //其他
   public static final String[] IDTYPE_DICTS = {"1", "2", "3", "4", "5", "9"}; //联动
 
-  public static final int SHOPTYPE_GROUP = 0; //商户组
-  public static final int SHOPTYPE_LEAF = 1;  //末级商户,独立核算商户
-
   public static final String FEETYPE_DEFAULT = "none";
   public static final String FEETYPE_MEALER = "mealer";
   public static final String FEETYPE_DISCOUNT = "discount";
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/util/EnumCheck.java b/payapi/src/main/java/com/supwisdom/dlpay/util/EnumCheck.java
new file mode 100644
index 0000000..953aa5f
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/util/EnumCheck.java
@@ -0,0 +1,12 @@
+package com.supwisdom.dlpay.util;
+
+public class EnumCheck<T, U> {
+  public boolean isInEnums(U value, T... expected) {
+    for (T item : expected) {
+      if (item.toString().equals(value)) {
+        return true;
+      }
+    }
+    return false;
+  }
+}
diff --git a/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/shop_service_impl.kt b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/shop_service_impl.kt
index 07c6c40..068cca7 100644
--- a/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/shop_service_impl.kt
+++ b/payapi/src/main/kotlin/com/supwisdom/dlpay/api/service/impl/shop_service_impl.kt
@@ -1,18 +1,19 @@
 package com.supwisdom.dlpay.api.service.impl
 
 import com.supwisdom.dlpay.api.bean.OpenShopParam
+import com.supwisdom.dlpay.api.service.ShopService
+import com.supwisdom.dlpay.api.util.ShopTypes
+import com.supwisdom.dlpay.exception.TransactionProcessException
 import com.supwisdom.dlpay.framework.dao.ShopDao
 import com.supwisdom.dlpay.framework.dao.ShopaccDao
 import com.supwisdom.dlpay.framework.domain.TShop
 import com.supwisdom.dlpay.framework.domain.TShopacc
 import com.supwisdom.dlpay.framework.service.SystemUtilService
-import com.supwisdom.dlpay.framework.util.Subject
-import com.supwisdom.dlpay.api.service.ShopService
-import com.supwisdom.dlpay.exception.TransactionProcessException
 import com.supwisdom.dlpay.framework.util.StringUtil
+import com.supwisdom.dlpay.framework.util.Subject
 import com.supwisdom.dlpay.framework.util.TradeDict
 import com.supwisdom.dlpay.framework.util.TradeErrorCode
-import com.supwisdom.dlpay.util.ConstantUtil
+import com.supwisdom.dlpay.util.EnumCheck
 import org.springframework.beans.factory.annotation.Autowired
 import org.springframework.stereotype.Service
 
@@ -28,8 +29,10 @@
     @Autowired
     private lateinit var systemUtilService: SystemUtilService
 
+    private val shoptypeCheck = EnumCheck<ShopTypes, String>()
+
     override fun findByThirdUniqueId(uniqueId: String): TShop? {
-       return shopDao.getByThirdUniqueIdenty(uniqueId)
+        return shopDao.getByThirdUniqueIdenty(uniqueId)
     }
 
     override fun registerShop(param: OpenShopParam): TShop {
@@ -60,7 +63,7 @@
             opendate = systemdatetime.hostdate
             thirdUniqueIdenty = param.shopUniqueId
         })
-        if (ConstantUtil.SHOPTYPE_GROUP != shop.shoptype) {
+        if (shoptypeCheck.isInEnums(shop.shoptype, ShopTypes.NORMAL)) {
             //非商户组要创建账号
             val shopaccno = String.format("2%09d", shop.shopid)
             shopaccDao.save(TShopacc().apply {
diff --git a/payapi/src/main/resources/data.sql b/payapi/src/main/resources/data.sql
index 83933b6..fdeebca 100644
--- a/payapi/src/main/resources/data.sql
+++ b/payapi/src/main/resources/data.sql
@@ -498,7 +498,7 @@
 VALUES ('DAYENDSETTLETASK', '日终结算', '0', '20190619100600', '{tenantid}');
 
 INSERT INTO "tb_shop" ("shopid", "shopname", "shoptype", "fshopid", "status", "opendate", "tenantid")
-VALUES (1, '支付中心', 0, 0, 'normal', '20190517', '{tenantid}');
+VALUES (1, '支付中心', 'root', 0, 'normal', '20190517', '{tenantid}');
 
 INSERT INTO "tb_transcode" ("transcode", "transname", "tenantid")
 VALUES (3010, '市民卡代扣', '{tenantid}');
diff --git a/payapi/src/main/resources/templates/system/shop/config.html b/payapi/src/main/resources/templates/system/shop/config.html
index b8acc1d..ed1b027 100644
--- a/payapi/src/main/resources/templates/system/shop/config.html
+++ b/payapi/src/main/resources/templates/system/shop/config.html
@@ -14,7 +14,8 @@
                         商户树<span style="font-size: 12px;">(双击结算商户查询)</span>
                     </div>
                     <div class="layui-card-body layui-show">
-                        <ul id="shopacctree" class="ztree" style="background-color: #D7F9F7;max-height: 560px;overflow:auto;"></ul>
+                        <ul id="shopacctree" class="ztree"
+                            style="background-color: #D7F9F7;max-height: 560px;overflow:auto;"></ul>
                     </div>
                 </div>
             </div>
@@ -28,16 +29,20 @@
                                 <option th:each="pt:${paytypelist}" th:value="${pt.sourceType}"
                                         th:text="${pt.paydesc}"></option>
                             </select>&emsp;
-                            <button id="btn-search-shopsourcetype" class="layui-btn icon-btn" data-type="search"><i class="layui-icon">&#xe615;</i>搜索
+                            <button id="btn-search-shopsourcetype" class="layui-btn icon-btn"
+                                    data-type="search"><i class="layui-icon">&#xe615;</i>搜索
                             </button>
-                            <button id="btn-add-shopsourcetype" class="layui-btn icon-btn" data-type="add"><i class="layui-icon">&#xe654;</i>新
+                            <button id="btn-add-shopsourcetype" class="layui-btn icon-btn" data-type="add"><i
+                                    class="layui-icon">&#xe654;</i>新

                             </button>
-                            <button id="btn-reset-shopsourcetype" class="layui-btn layui-btn-primary" data-type="reset"><i
+                            <button id="btn-reset-shopsourcetype" class="layui-btn layui-btn-primary"
+                                    data-type="reset"><i
                                     class="layui-icon"></i>清 空
                             </button>
                         </div>
-                        <table class="layui-table" id="shopPaytypeTable" lay-filter="shopPaytypeTable-filter"></table>
+                        <table class="layui-table" id="shopPaytypeTable"
+                               lay-filter="shopPaytypeTable-filter"></table>
                     </div>
                 </div>
             </div>
@@ -47,22 +52,26 @@
 
 <!-- 表格状态列 -->
 <script type="text/html" id="shop-consumeenable-tpl-state">
-    <input type="checkbox" lay-filter="shop-consumeenable-tpl-state" value="{{d.shopaccno}}" def-sourceType="{{d.sourceType}}" lay-skin="switch" lay-text="启用|关闭"
+    <input type="checkbox" lay-filter="shop-consumeenable-tpl-state" value="{{d.shopaccno}}"
+           def-sourceType="{{d.sourceType}}" lay-skin="switch" lay-text="启用|关闭"
            {{d.consumeEnable==true?'checked':''}}/>
 </script>
 <script type="text/html" id="shop-anonymousenable-tpl-state">
     {{# if(d.consumeEnable == true ){ }}
-    <input type="checkbox" lay-filter="shop-anonymousenable-tpl-state" value="{{d.shopaccno}}" def-sourceType="{{d.sourceType}}" lay-skin="switch"
+    <input type="checkbox" lay-filter="shop-anonymousenable-tpl-state" value="{{d.shopaccno}}"
+           def-sourceType="{{d.sourceType}}" lay-skin="switch"
            lay-text="启用|关闭"
            {{(d.consumeEnable==true && d.anonymousEnable==true)?'checked':''}}/>
     {{# }else{ }}
-    <input type="checkbox" lay-filter="shop-anonymousenable-tpl-state" value="{{d.shopaccno}}" def-sourceType="{{d.sourceType}}" lay-skin="switch"
+    <input type="checkbox" lay-filter="shop-anonymousenable-tpl-state" value="{{d.shopaccno}}"
+           def-sourceType="{{d.sourceType}}" lay-skin="switch"
            lay-text="启用|关闭"
            {{(d.consumeEnable==true && d.anonymousEnable==true)?'checked':''}} disabled/>
     {{# } }}
 </script>
 <script type="text/html" id="shop-reverseenable-tpl-state">
-    <input type="checkbox" lay-filter="shop-reverseenable-tpl-state" value="{{d.shopaccno}}" def-sourceType="{{d.sourceType}}" lay-skin="switch" lay-text="启用|关闭"
+    <input type="checkbox" lay-filter="shop-reverseenable-tpl-state" value="{{d.shopaccno}}"
+           def-sourceType="{{d.sourceType}}" lay-skin="switch" lay-text="启用|关闭"
            {{d.reverseEnable==true?'checked':''}}/>
 </script>
 
@@ -110,18 +119,21 @@
             $("#search-sourceType").val("");
             form.render('select');
         });
-        $('#btn-search-shopsourcetype').click(function(){
+        $('#btn-search-shopsourcetype').click(function () {
             var ptype = $("#search-sourceType").val();
-            table.reload('shopPaytypeTable', {where: {sourceType: ptype, shopaccno:""}, page: {curr: 1}});
+            table.reload('shopPaytypeTable', {where: {sourceType: ptype, shopaccno: ""}, page: {curr: 1}});
         });
 
         function ondblclick(event, treeId, treeNode) {
-            if (treeNode.shoptype !== 1 || ""===treeNode.shopaccno) {
+            if (treeNode.shoptype !== 'normal' || "" === treeNode.shopaccno) {
                 layer.msg("请选择结算商户查询", {icon: 2, time: 1000});
                 return;
             }
             var ptype = $("#search-sourceType").val();
-            table.reload('shopPaytypeTable', {where: {sourceType: ptype, shopaccno: treeNode.shopaccno}, page: {curr: 1}});
+            table.reload('shopPaytypeTable', {
+                where: {sourceType: ptype, shopaccno: treeNode.shopaccno},
+                page: {curr: 1}
+            });
         }
 
         // 渲染表格
@@ -132,8 +144,15 @@
             width: 1010,
             cols: [
                 [
-                    {field: 'shopaccno', title: '商户账号', width: 150, align: 'center', fixed: 'left', sort: true},
-                    {field: 'shopname', title: '商户名称',  align: 'center', fixed: 'left', sort: true},
+                    {
+                        field: 'shopaccno',
+                        title: '商户账号',
+                        width: 150,
+                        align: 'center',
+                        fixed: 'left',
+                        sort: true
+                    },
+                    {field: 'shopname', title: '商户名称', align: 'center', fixed: 'left', sort: true},
                     {field: 'paydesc', title: '支付方式', align: 'center', sort: true},
                     {
                         field: 'consumeEnable',
@@ -159,7 +178,8 @@
                         templet: '#shop-reverseenable-tpl-state',
                         sort: true
                     },
-                    {align: 'center', title: '操作', width: 90, fixed: 'right', templet: function (item) {
+                    {
+                        align: 'center', title: '操作', width: 90, fixed: 'right', templet: function (item) {
                             if (item.sourceType !== 'balance') {
                                 return '<a class="layui-btn layui-btn-xs" lay-event="config">配置</a>';
                             }
@@ -181,7 +201,7 @@
                 _csrf: token
             }, function (data) {
                 if (data.code === 200) {
-                    layer.msg(data.msg, {icon: 1, time:1000});
+                    layer.msg(data.msg, {icon: 1, time: 1000});
                     table.reload('shopPaytypeTable');
                 } else if (data.code === 401) {
                     layer.msg(data.msg, {icon: 2, time: 1500}, function () {
@@ -192,7 +212,7 @@
                     $(obj.elem).prop('checked', !obj.elem.checked);
                     form.render('checkbox');
                 }
-            },function () {
+            }, function () {
                 layer.msg('请求失败了,请稍后再试', {icon: 2});
                 $(obj.elem).prop('checked', !obj.elem.checked);
                 form.render('checkbox');
@@ -243,13 +263,13 @@
                 return;
             }
             var shopNode = shopNodes[0]; //选中商户
-            if(shopNode.shoptype!==1 || ""===shopNode.shopaccno){
+            if (shopNode.shoptype !== 'normal' || "" === shopNode.shopaccno) {
                 layer.msg("请选择结算商户!", {icon: 2, time: 1000});
                 return;
             }
             admin.putTempData('t_addshopsourcetype', {
-                shopaccno:shopNode.shopaccno,
-                shopname: shopNode.name.slice(shopNode.id.length+1)  //23_第一食堂,截取商户名称
+                shopaccno: shopNode.shopaccno,
+                shopname: shopNode.name.slice(shopNode.id.length + 1)  //23_第一食堂,截取商户名称
             });
             admin.popupCenter({
                 title: "新增支付能力",
diff --git a/payapi/src/main/resources/templates/system/shop/index.html b/payapi/src/main/resources/templates/system/shop/index.html
index 0da8653..32ab1dc 100644
--- a/payapi/src/main/resources/templates/system/shop/index.html
+++ b/payapi/src/main/resources/templates/system/shop/index.html
@@ -14,20 +14,24 @@
                         商户树<span style="font-size: 12px;">(双击商户进行修改)</span>
                     </div>
                     <div class="layui-card-body layui-show" style="margin-bottom: 15px;">
-                        <ul id="shoptree" class="ztree" style="background-color: #D7F9F7;max-height: 527px;overflow:auto;"></ul>
+                        <ul id="shoptree" class="ztree"
+                            style="background-color: #D7F9F7;max-height: 527px;overflow:auto;"></ul>
                     </div>
                 </div>
             </div>
             <div class="layui-col-xs7 layui-col-md9">
                 <div class="layui-card" style="min-height: 600px;">
-                    <div id="shop-info" class="layui-form toolbar" lay-filter="shop-info-form" style="display: none;">
+                    <div id="shop-info" class="layui-form toolbar" lay-filter="shop-info-form"
+                         style="display: none;">
                         <div class="layui-card-header">商户基本信息</div>
                         <div class="layui-form-item" style="margin-left: 15px;">
-                            <label class="layui-form-label" style="color: red;"><span style="color: red;">*</span>商户类型</label>
+                            <label class="layui-form-label" style="color: red;"><span
+                                    style="color: red;">*</span>商户类型</label>
                             <div class="layui-input-inline">
-                                <select name="shoptype" id="shoptype" lay-filter="shoptype-filter" lay-verify="required">
-                                    <option value="0">商户组</option>
-                                    <option value="1">结算商户</option>
+                                <select name="shoptype" id="shoptype" lay-filter="shoptype-filter"
+                                        lay-verify="required">
+                                    <option value="group">商户组</option>
+                                    <option value="normal">结算商户</option>
                                 </select>
                             </div>
                             <div class="layui-form-mid layui-word-aux">
@@ -39,28 +43,33 @@
                                 <div class="layui-inline">
                                     <label class="layui-form-label">商户号</label>
                                     <div class="layui-input-inline">
-                                        <input type="text" name="shopid" class="layui-input" style="background-color: #f1f1f1;"
+                                        <input type="text" name="shopid" class="layui-input"
+                                               style="background-color: #f1f1f1;"
                                                readonly="readonly"/>
                                     </div>
                                 </div>
                                 <div class="layui-inline">
                                     <label class="layui-form-label">商户账号</label>
                                     <div class="layui-input-inline">
-                                        <input type="text" name="shopaccno" autocomplete="off" style="background-color: #f1f1f1;"
+                                        <input type="text" name="shopaccno" autocomplete="off"
+                                               style="background-color: #f1f1f1;"
                                                class="layui-input" readonly="readonly"/>
                                     </div>
                                 </div>
                             </div>
                             <div class="layui-form-item">
                                 <div class="layui-inline">
-                                    <label class="layui-form-label"><span style="color: red;">*</span>上级商户号</label>
+                                    <label class="layui-form-label"><span
+                                            style="color: red;">*</span>上级商户号</label>
                                     <div class="layui-input-inline">
-                                        <input type="text" name="fshopid" id="fshopid" class="layui-input" autocomplete="off"
+                                        <input type="text" name="fshopid" id="fshopid" class="layui-input"
+                                               autocomplete="off"
                                                lay-verify="required|number"/>
                                     </div>
                                 </div>
                                 <div class="layui-inline">
-                                    <label class="layui-form-label"><span style="color: red;">*</span>商户名</label>
+                                    <label class="layui-form-label"><span
+                                            style="color: red;">*</span>商户名</label>
                                     <div class="layui-input-inline">
                                         <input type="text" name="shopname" autocomplete="off"
                                                class="layui-input" maxlength="30" lay-verify="required"/>
@@ -72,13 +81,15 @@
                                 <div class="layui-inline">
                                     <label class="layui-form-label">邮编</label>
                                     <div class="layui-input-inline">
-                                        <input type="text" name="zipcode" class="layui-input" autocomplete="off" />
+                                        <input type="text" name="zipcode" class="layui-input"
+                                               autocomplete="off"/>
                                     </div>
                                 </div>
                                 <div class="layui-inline">
                                     <label class="layui-form-label">地址</label>
                                     <div class="layui-input-inline">
-                                        <input type="text" name="addr" class="layui-input" maxlength="40" autocomplete="off" />
+                                        <input type="text" name="addr" class="layui-input" maxlength="40"
+                                               autocomplete="off"/>
                                     </div>
                                 </div>
                             </div>
@@ -89,19 +100,21 @@
                                 <div class="layui-inline">
                                     <label class="layui-form-label">姓名</label>
                                     <div class="layui-input-inline">
-                                        <input type="text" name="contactman" class="layui-input" autocomplete="off"/>
+                                        <input type="text" name="contactman" class="layui-input"
+                                               autocomplete="off"/>
                                     </div>
                                 </div>
                                 <div class="layui-inline">
                                     <label class="layui-form-label">手机号</label>
                                     <div class="layui-input-inline">
-                                        <input type="text" name="mobile" class="layui-input" maxlength="20" autocomplete="off"
-                                               lay-verify="mobile" />
+                                        <input type="text" name="mobile" class="layui-input" maxlength="20"
+                                               autocomplete="off"
+                                               lay-verify="mobile"/>
                                     </div>
                                 </div>
                             </div>
                             <div class="layui-form-item">
-                                <div class="layui-inline" >
+                                <div class="layui-inline">
                                     <label class="layui-form-label">证件类型</label>
                                     <div class="layui-input-inline">
                                         <select name="idtype" lay-filter="idtype-filter">
@@ -117,7 +130,8 @@
                                 <div class="layui-inline">
                                     <label class="layui-form-label">证件号</label>
                                     <div class="layui-input-inline">
-                                        <input type="text" name="idno" class="layui-input" maxlength="20" autocomplete="off"/>
+                                        <input type="text" name="idno" class="layui-input" maxlength="20"
+                                               autocomplete="off"/>
                                     </div>
                                 </div>
                             </div>
@@ -125,23 +139,29 @@
                                 <div class="layui-inline">
                                     <label class="layui-form-label">邮箱</label>
                                     <div class="layui-input-inline">
-                                        <input type="text" name="email" class="layui-input" autocomplete="off" lay-verify="swEmail"/>
+                                        <input type="text" name="email" class="layui-input" autocomplete="off"
+                                               lay-verify="swEmail"/>
                                     </div>
                                 </div>
                                 <div class="layui-inline">
                                     <label class="layui-form-label">电话</label>
                                     <div class="layui-input-inline">
-                                        <input type="text" name="tel" class="layui-input" maxlength="20" autocomplete="off" />
+                                        <input type="text" name="tel" class="layui-input" maxlength="20"
+                                               autocomplete="off"/>
                                     </div>
                                 </div>
                             </div>
                         </div>
 
                         <div class="layui-form-item" style="padding-bottom: 20px;text-align: center;">
-                            <button class="layui-btn" lay-filter="form-submit-shop-btn" lay-submit id="submitbtn-shop-btn">保存</button>
-                            <button class="layui-btn layui-btn-primary" type="button" id="cancelbtn">取消</button>
+                            <button class="layui-btn" lay-filter="form-submit-shop-btn" lay-submit
+                                    id="submitbtn-shop-btn">保存
+                            </button>
+                            <button class="layui-btn layui-btn-primary" type="button" id="cancelbtn">取消
+                            </button>
                             <div class="layui-inline" style="margin-left: 10px;" id="shop-add-hid-div">
-                                <input type="checkbox" id="shop-add-continue-flag" lay-skin="primary" title="继续新增" />
+                                <input type="checkbox" id="shop-add-continue-flag" lay-skin="primary"
+                                       title="继续新增"/>
                             </div>
                         </div>
                     </div>
@@ -209,7 +229,7 @@
             var zTree = $.fn.zTree.getZTreeObj("shoptree");
             if (treeNode.isParent) {
                 var childrenNodes = treeNode.children;
-                if (childrenNodes && childrenNodes.length != 0) {
+                if (childrenNodes && childrenNodes.length !== 0) {
                     layer.msg("请先删除下级商户", {icon: 2, time: 2000});
                     return false;
                 }
@@ -230,10 +250,10 @@
                     success: function (result) {
                         console.log(result);
                         layer.closeAll('loading');
-                        if (result.code == 200) {
+                        if (result.code === 200) {
                             layer.msg(result.msg, {icon: 1});
                             flag = true;
-                        } else if (result.code == 401) {
+                        } else if (result.code === 401) {
                             layer.msg(result.msg, {icon: 2, time: 1500}, function () {
                                 location.replace('[[@{/login}]]');
                             }, 1000);
@@ -272,11 +292,11 @@
                 success: function (result) {
                     layer.closeAll('loading');
                     debugger
-                    if (result.code == 200) {
+                    if (result.code === 200) {
                         var zTree = $.fn.zTree.getZTreeObj("shoptree");
                         var treeNode = zTree.getNodeByParam("id", '' + result.shop.shopid, null);
-                        if (undefined != treeNode && null != treeNode) {
-                            treeNode.id = ''+result.shop.shopid;
+                        if (undefined !== treeNode && treeNode != null) {
+                            treeNode.id = '' + result.shop.shopid;
                             treeNode.pId = '' + result.shop.fshopid;
                             treeNode.name = '' + result.shop.shopid + '_' + result.shop.shopname;
                             zTree.updateNode(treeNode); //修改节点
@@ -288,7 +308,7 @@
                                 name: '' + result.shop.shopid + '_' + result.shop.shopname,
                                 shoptype: result.shop.shoptype
                             }
-                            if (result.shop.shoptype == 1) {
+                            if (result.shop.shoptype === 'normal') {
                                 newNode["iconSkin"] = "pIcon02";
                             } else {
                                 newNode["iconSkin"] = "pIcon01";
@@ -299,11 +319,10 @@
                         if (!$("#shop-add-continue-flag").is(":checked")) {
                             $("#shop-info").hide();
                         }
-                    } else if (result.code == 401) {
+                    } else if (result.code === 401) {
                         layer.msg(result.msg, {icon: 2, time: 1500}, function () {
                             location.replace('[[@{/login}]]');
                         }, 1000);
-                        return;
                     } else {
                         console.log('err:' + result.code);
                         layer.msg(result.msg, {icon: 2});
@@ -317,7 +336,7 @@
         });
 
         function addHoverDom(treeId, treeNode) {
-            if (treeNode.shoptype == 0) {
+            if (treeNode.shoptype !== 'normal') {
                 var sObj = $("#" + treeNode.tId + "_span");
                 if (treeNode.editNameFlag || $("#addBtn_" + treeNode.tId).length > 0) return;
                 var addStr = "<span class='button add' id='addBtn_" + treeNode.tId
@@ -325,20 +344,20 @@
                 sObj.after(addStr);
                 var btn = $("#addBtn_" + treeNode.tId);
                 if (btn) btn.bind("click", function () {
-                    form.val("shop-info-form",{
-                        "shopid":"0",
+                    form.val("shop-info-form", {
+                        "shopid": "0",
                         "shopname": "",
-                        "shopaccno":"",
-                        "fshopid":treeNode.id,
-                        "shoptype":"1",
-                        "zipcode":"",
-                        "addr":"",
-                        "contactman":"",
-                        "idtype":"1",
-                        "idno":"",
-                        "mobile":"",
-                        "email":"",
-                        "tel":""
+                        "shopaccno": "",
+                        "fshopid": treeNode.id,
+                        "shoptype": "normal",
+                        "zipcode": "",
+                        "addr": "",
+                        "contactman": "",
+                        "idtype": "1",
+                        "idno": "",
+                        "mobile": "",
+                        "email": "",
+                        "tel": ""
                     });
                     $("#fshopid").attr("readonly", "readonly");
                     $("#shoptype").removeAttr("disabled");
@@ -356,9 +375,9 @@
             admin.dgo('[[@{/shop/getshopinfo}]]', {
                 "shopid": treeNode.id
             }, function (data) {
-                console.log("getshopinfo返回",data);
-                if (data.code == 200) {
-                    form.val("shop-info-form",data.shop);
+                console.log("getshopinfo返回", data);
+                if (data.code === 200) {
+                    form.val("shop-info-form", data.shop);
                     $("#fshopid").removeAttr("readonly");
                     $("#shoptype").attr('disabled', 'disabled');
                     form.render('select');
@@ -366,11 +385,10 @@
                     $("#shop-add-continue-flag").prop("checked", false);
                     $("#shop-add-hid-div").hide();
                     $("#shop-info").show();
-                } else if (data.code == 401) {
+                } else if (data.code === 401) {
                     layer.msg(data.msg, {icon: 2, time: 1500}, function () {
                         location.replace('[[@{/login}]]');
                     }, 1000);
-                    return;
                 } else {
                     layer.msg(data.msg, {icon: 2, time: 2000});
                 }
@@ -381,13 +399,12 @@
         }
 
         admin.dgo('[[@{/shop/shoptree}]]', {}, function (data) {
-            if (data.code == 200) {
+            if (data.code === 200) {
                 initTree(data.data);
-            } else if (data.code == 401) {
+            } else if (data.code === 401) {
                 layer.msg(data.msg, {icon: 2, time: 1500}, function () {
                     location.replace('[[@{/login}]]');
                 }, 1000);
-                return;
             } else {
                 layer.msg(data.msg, {icon: 2, time: 2000});
             }