商户审批
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/OperChkdtlDao.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/OperChkdtlDao.java
new file mode 100644
index 0000000..4a08c33
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/OperChkdtlDao.java
@@ -0,0 +1,30 @@
+package com.supwisdom.dlpay.framework.dao;
+
+import com.supwisdom.dlpay.framework.data.ExistBean;
+import com.supwisdom.dlpay.framework.domain.TOperChkdtl;
+import org.springframework.data.jpa.repository.*;
+import org.springframework.stereotype.Repository;
+
+import javax.persistence.LockModeType;
+
+@Repository
+public interface OperChkdtlDao extends JpaRepository<TOperChkdtl, Long>, JpaSpecificationExecutor<TOperChkdtl> {
+
+  @Modifying
+  @Query("update TOperChkdtl set invalidflag=true where chkType=?1 and contentId=?2 and chkResult='uncheck' ")
+  void doClearChkdtl(String chktype, String contentId);
+
+  @Modifying
+  @Query("update TOperChkdtl set invalidflag=true where chkType=?1 and chkMode=?2 and contentId=?3 and chkResult='uncheck' ")
+  void doClearChkdtl(String chktype, String chkmode, String contentId);
+
+  @Query("select count(t.chkNo) as existed from TOperChkdtl t where t.chkType=?1 and t.chkMode=?2 and t.contentId=?3 and t.chkResult=?4 and t.invalidflag=false ")
+  ExistBean getChkdtlCount(String chktype, String chkmode, String contentId, String chkresult);
+
+  @Query("from TOperChkdtl where chkNo=?1 ")
+  TOperChkdtl getByChkno(Long chkNo);
+
+  @Lock(LockModeType.PESSIMISTIC_WRITE)
+  @Query("from TOperChkdtl where chkNo=?1 ")
+  TOperChkdtl getByChknoForUpdate(Long chkNo);
+}
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/ShopDao.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/ShopDao.java
index efa53d3..e6ea3c1 100644
--- a/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/ShopDao.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/ShopDao.java
@@ -2,6 +2,7 @@
 
 import com.supwisdom.dlpay.framework.domain.TShop;
 import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 import org.springframework.data.jpa.repository.Lock;
 import org.springframework.data.jpa.repository.Query;
 
@@ -11,7 +12,7 @@
 /**
  * Created by shuwei on 2019/4/15.
  */
-public interface ShopDao extends JpaRepository<TShop, Integer> {
+public interface ShopDao extends JpaRepository<TShop, Integer>, JpaSpecificationExecutor<TShop> {
     TShop getByThirdUniqueIdenty(String thirdUniqueIdenty);
 
     @Lock(LockModeType.PESSIMISTIC_WRITE)
@@ -25,7 +26,7 @@
     @Query("from TShop where status='normal' and fshopid=?1 ")
     List<TShop> getChildShopsByShopid(Integer shopid);
 
-    @Query(value = "select count(t.shopid) from TB_SHOP t where t.status='normal' and t.shopname=?1 and t.fshopid=?2 and t.shopid!=?3", nativeQuery = true)
+    @Query(value = "select count(t.shopid) from TB_SHOP t where (t.status='normal' or t.status='uncheck')  and t.shopname=?1 and t.fshopid=?2 and t.shopid!=?3", nativeQuery = true)
     long checkShopnameExist(String shopname, int fshopid, int oldShopid);
 
     @Query("from TShop where status='normal' order by shopid asc ")
@@ -33,4 +34,10 @@
 
     @Query("from TShop where shoptype='root' and status='normal' order by shopid asc ")
     List<TShop> getRootNormalShops();
+
+    @Query("from TShop where shoptype='root' order by shopid asc ")
+    List<TShop> getRootShops();
+
+    @Query("from TShop order by shopid asc ")
+    List<TShop> findAllShops();
 }
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/ShopaccDao.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/ShopaccDao.java
index db210cd..77b5204 100644
--- a/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/ShopaccDao.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/dao/ShopaccDao.java
@@ -39,8 +39,7 @@
 
   TShopacc getByShopaccnoAndTenantId(String shopaccno, String tenantid);
 
-  @Transactional
-  @Modifying(clearAutomatically = true)
+  @Modifying
   @Query("update TShopacc set shopname=?1 where shopaccno=?2")
   void updateShopnameByShopaccno(String shopname, String shopaccno);
 
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TOperChkdtl.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TOperChkdtl.java
new file mode 100644
index 0000000..ba1afa1
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/domain/TOperChkdtl.java
@@ -0,0 +1,179 @@
+package com.supwisdom.dlpay.framework.domain;
+
+import javax.persistence.*;
+
+/**
+ * 操作员审批表
+ * */
+@Entity
+@Table(name = "TB_OPER_CHKDTL",
+    indexes = {@Index(name = "tb_oper_chkdtl_index", columnList = "CHKTYPE,CHKMODE")})
+public class TOperChkdtl {
+  @Id
+  @SequenceGenerator(name = "operchkno", sequenceName = "SEQ_OPERCHKNO", allocationSize = 1, initialValue = 10000)
+  @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "operchkno")
+  @Column(name = "CHKNO", nullable = false, precision = 10)
+  private Long chkNo; //审批编号
+
+  @Column(name = "CHKTYPE", nullable = false, length = 32)
+  private String chkType; //审批类型
+
+  @Column(name = "CHKMODE", nullable = false, length = 32)
+  private String chkMode; //新增/修改/删除
+
+  @Column(name = "CONTENT_ID", length = 32)
+  private String contentId; //对应Id
+
+  @Column(name = "CONTENT", length = 4000)
+  private String content; //内容
+
+  @Column(name = "CHKRESULT", nullable = false, length = 600)
+  private String chkResult; //审核结果
+
+  @Column(name = "CHKMSG", length = 600)
+  private String chkMsg; //审核意见
+
+  @Column(name = "CREATE_OPERID", length = 32)
+  private String createOperid; //创建者
+
+  @Column(name = "CREATE_OPERNAME", length = 100)
+  private String createOpername; //创建者名称
+
+  @Column(name = "CREATETIME", length = 14)
+  private String createtime; //创建时间
+
+  @Column(name = "CHECK_OPERID", length = 32)
+  private String checkOperid; //审核者
+
+  @Column(name = "CHECK_OPERNAME", length = 100)
+  private String checkOpername; //审核者名称
+
+  @Column(name = "CHECKTIME", length = 14)
+  private String checktime; //审核时间
+
+  @Column(name = "INVALIDFLAG", length = 10)
+  private Boolean invalidflag=false; //无效标志: true-无效;false-有效
+
+  @Column(name = "tenantid", nullable = false, length = 20)
+  private String tenantId;
+
+  public Long getChkNo() {
+    return chkNo;
+  }
+
+  public void setChkNo(Long chkNo) {
+    this.chkNo = chkNo;
+  }
+
+  public String getChkType() {
+    return chkType;
+  }
+
+  public void setChkType(String chkType) {
+    this.chkType = chkType;
+  }
+
+  public String getChkMode() {
+    return chkMode;
+  }
+
+  public void setChkMode(String chkMode) {
+    this.chkMode = chkMode;
+  }
+
+  public String getContentId() {
+    return contentId;
+  }
+
+  public void setContentId(String contentId) {
+    this.contentId = contentId;
+  }
+
+  public String getContent() {
+    return content;
+  }
+
+  public void setContent(String content) {
+    this.content = content;
+  }
+
+  public String getChkResult() {
+    return chkResult;
+  }
+
+  public void setChkResult(String chkResult) {
+    this.chkResult = chkResult;
+  }
+
+  public String getChkMsg() {
+    return chkMsg;
+  }
+
+  public void setChkMsg(String chkMsg) {
+    this.chkMsg = chkMsg;
+  }
+
+  public String getCreateOperid() {
+    return createOperid;
+  }
+
+  public void setCreateOperid(String createOperid) {
+    this.createOperid = createOperid;
+  }
+
+  public String getCreateOpername() {
+    return createOpername;
+  }
+
+  public void setCreateOpername(String createOpername) {
+    this.createOpername = createOpername;
+  }
+
+  public String getCreatetime() {
+    return createtime;
+  }
+
+  public void setCreatetime(String createtime) {
+    this.createtime = createtime;
+  }
+
+  public String getCheckOperid() {
+    return checkOperid;
+  }
+
+  public void setCheckOperid(String checkOperid) {
+    this.checkOperid = checkOperid;
+  }
+
+  public String getCheckOpername() {
+    return checkOpername;
+  }
+
+  public void setCheckOpername(String checkOpername) {
+    this.checkOpername = checkOpername;
+  }
+
+  public String getChecktime() {
+    return checktime;
+  }
+
+  public void setChecktime(String checktime) {
+    this.checktime = checktime;
+  }
+
+  public Boolean getInvalidflag() {
+    return invalidflag;
+  }
+
+  public void setInvalidflag(Boolean invalidflag) {
+    this.invalidflag = invalidflag;
+  }
+
+  public String getTenantId() {
+    return tenantId;
+  }
+
+  public void setTenantId(String tenantId) {
+    this.tenantId = tenantId;
+  }
+}
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 5c81f45..76ee122 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
@@ -3,6 +3,7 @@
 
 import javax.persistence.*;
 import javax.validation.constraints.NotNull;
+import java.sql.Timestamp;
 
 @Entity
 @Table(name = "TB_SHOP",
@@ -73,6 +74,28 @@
   @Column(name = "THIRD_UNIQUE_IDENTY", length = 200)
   private String thirdUniqueIdenty;
 
+  //扩展信息
+  @Column(name = "BUSINESS_LICENSE_NO", length = 60)
+  private String businessLicenseNo; //营业执照编号
+
+  @Column(name = "TAX_REGISTRATION_NO", length = 60)
+  private String taxRegistrationNo; //税务登记号
+
+  @Column(name = "LEGAL_PERSON_NAME", length = 60)
+  private String legalPersonName; //法人姓名
+
+  @Column(name = "LEGAL_PERSON_IDTYPE", length = 32)
+  private String legalPersonIdtype; //法人证件类型
+
+  @Column(name = "LEGAL_PERSON_IDNO", length = 32)
+  private String legalPersonIdno; //法人证件号码
+
+  @Column(name = "ADD_OPERID", length = 32)
+  private String addOperid; //新增操作员
+
+  @Column(name = "DEL_OPERID", length = 32)
+  private String delOperid; //删除操作员
+
   public TShop() {
   }
 
@@ -95,6 +118,33 @@
     this.thirdUniqueIdenty = thirdUniqueIdenty;
   }
 
+  public TShop(@NotNull Integer fshopid, @NotNull String shopname, @NotNull String shoptype, @NotNull String status, String shopaccno, String contactman, String idtype, String idno, String tel, String mobile, String email, String addr, String zipcode, String opendate, String closedate, @NotNull String tenantId, String thirdUniqueIdenty, String businessLicenseNo, String taxRegistrationNo, String legalPersonName, String legalPersonIdtype, String legalPersonIdno, String addOperid, String delOperid) {
+    this.fshopid = fshopid;
+    this.shopname = shopname;
+    this.shoptype = shoptype;
+    this.status = status;
+    this.shopaccno = shopaccno;
+    this.contactman = contactman;
+    this.idtype = idtype;
+    this.idno = idno;
+    this.tel = tel;
+    this.mobile = mobile;
+    this.email = email;
+    this.addr = addr;
+    this.zipcode = zipcode;
+    this.opendate = opendate;
+    this.closedate = closedate;
+    this.tenantId = tenantId;
+    this.thirdUniqueIdenty = thirdUniqueIdenty;
+    this.businessLicenseNo = businessLicenseNo;
+    this.taxRegistrationNo = taxRegistrationNo;
+    this.legalPersonName = legalPersonName;
+    this.legalPersonIdtype = legalPersonIdtype;
+    this.legalPersonIdno = legalPersonIdno;
+    this.addOperid = addOperid;
+    this.delOperid = delOperid;
+  }
+
   public String getThirdUniqueIdenty() {
     return thirdUniqueIdenty;
   }
@@ -238,4 +288,60 @@
   public void setTenantId(String tenantId) {
     this.tenantId = tenantId;
   }
+
+  public String getBusinessLicenseNo() {
+    return businessLicenseNo;
+  }
+
+  public void setBusinessLicenseNo(String businessLicenseNo) {
+    this.businessLicenseNo = businessLicenseNo;
+  }
+
+  public String getTaxRegistrationNo() {
+    return taxRegistrationNo;
+  }
+
+  public void setTaxRegistrationNo(String taxRegistrationNo) {
+    this.taxRegistrationNo = taxRegistrationNo;
+  }
+
+  public String getLegalPersonName() {
+    return legalPersonName;
+  }
+
+  public void setLegalPersonName(String legalPersonName) {
+    this.legalPersonName = legalPersonName;
+  }
+
+  public String getLegalPersonIdtype() {
+    return legalPersonIdtype;
+  }
+
+  public void setLegalPersonIdtype(String legalPersonIdtype) {
+    this.legalPersonIdtype = legalPersonIdtype;
+  }
+
+  public String getLegalPersonIdno() {
+    return legalPersonIdno;
+  }
+
+  public void setLegalPersonIdno(String legalPersonIdno) {
+    this.legalPersonIdno = legalPersonIdno;
+  }
+
+  public String getAddOperid() {
+    return addOperid;
+  }
+
+  public void setAddOperid(String addOperid) {
+    this.addOperid = addOperid;
+  }
+
+  public String getDelOperid() {
+    return delOperid;
+  }
+
+  public void setDelOperid(String delOperid) {
+    this.delOperid = delOperid;
+  }
 }
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/framework/util/SysparaUtil.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/util/SysparaUtil.java
index a67d6ff..f87b96b 100644
--- a/payapi/src/main/java/com/supwisdom/dlpay/framework/util/SysparaUtil.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/util/SysparaUtil.java
@@ -11,9 +11,10 @@
 
 
   public static final int BALANCE_LIMIT = 1; //系统默认最大余额限制的ID
-  public static final int MOBILE_LOGIN_EXPIRE_IN_SECONDS = 4; //手机端用户过期时间(秒)
   public static final int NOPASS_LIMIT = 2; //默认免密额度
   public static final int DAY_PAY_LIMIT = 3; //默认日累计额度
+  public static final int MOBILE_LOGIN_EXPIRE_IN_SECONDS = 4; //手机端用户过期时间(秒)
+  public static final int SHOP_NEEDCHECK_SWITCH = 5; //商户是否需要审核:1-需要;0-不需要
 
   public static final int DLCARDMANAGER_APPID = 2019; //与卡管系统对接的应用ID
   public static final int DLCARDMANAGER_SECRET = 2020; //与卡管系统对接的应用appkey
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/framework/util/TradeDict.java b/payapi/src/main/java/com/supwisdom/dlpay/framework/util/TradeDict.java
index c59dfd1..9c2162f 100644
--- a/payapi/src/main/java/com/supwisdom/dlpay/framework/util/TradeDict.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/framework/util/TradeDict.java
@@ -18,6 +18,8 @@
   public static final String STATUS_FROZEN = "frozen";
   public static final String STATUS_UNUSE = "unuse";
   public static final String STATUS_ABNORMAL = "abnormal";
+  public static final String STATUS_UNCHECK = "uncheck";
+  public static final String STATUS_REJECT = "reject";
 
   public static final String STATUS_YES = "yes";
   public static final String STATUS_NO = "no";
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/system/bean/ShopCheckBean.java b/payapi/src/main/java/com/supwisdom/dlpay/system/bean/ShopCheckBean.java
new file mode 100644
index 0000000..9ed4304
--- /dev/null
+++ b/payapi/src/main/java/com/supwisdom/dlpay/system/bean/ShopCheckBean.java
@@ -0,0 +1,125 @@
+package com.supwisdom.dlpay.system.bean;
+
+import com.supwisdom.dlpay.framework.domain.TShop;
+
+public class ShopCheckBean extends TShop {
+  private String fshopname;
+  private Integer oldFshopid;
+  private String oldFshopname;
+  private String oldShopname;
+
+  private String oldBusinessLicenseNo; //营业执照编号
+  private String oldTaxRegistrationNo; //税务登记号
+  private String oldLegalPersonName; //法人姓名
+  private String oldLegalPersonIdtype; //法人证件类型
+  private String oldLegalPersonIdno; //法人证件号码
+
+  private String oldContactman;
+  private String oldMobile;
+  private String oldEmail;
+  private String oldTel;
+
+  public String getFshopname() {
+    return fshopname;
+  }
+
+  public void setFshopname(String fshopname) {
+    this.fshopname = fshopname;
+  }
+
+  public String getOldFshopname() {
+    return oldFshopname;
+  }
+
+  public void setOldFshopname(String oldFshopname) {
+    this.oldFshopname = oldFshopname;
+  }
+
+  public String getOldShopname() {
+    return oldShopname;
+  }
+
+  public void setOldShopname(String oldShopname) {
+    this.oldShopname = oldShopname;
+  }
+
+  public String getOldBusinessLicenseNo() {
+    return oldBusinessLicenseNo;
+  }
+
+  public void setOldBusinessLicenseNo(String oldBusinessLicenseNo) {
+    this.oldBusinessLicenseNo = oldBusinessLicenseNo;
+  }
+
+  public String getOldTaxRegistrationNo() {
+    return oldTaxRegistrationNo;
+  }
+
+  public void setOldTaxRegistrationNo(String oldTaxRegistrationNo) {
+    this.oldTaxRegistrationNo = oldTaxRegistrationNo;
+  }
+
+  public String getOldLegalPersonName() {
+    return oldLegalPersonName;
+  }
+
+  public void setOldLegalPersonName(String oldLegalPersonName) {
+    this.oldLegalPersonName = oldLegalPersonName;
+  }
+
+  public String getOldLegalPersonIdtype() {
+    return oldLegalPersonIdtype;
+  }
+
+  public void setOldLegalPersonIdtype(String oldLegalPersonIdtype) {
+    this.oldLegalPersonIdtype = oldLegalPersonIdtype;
+  }
+
+  public String getOldLegalPersonIdno() {
+    return oldLegalPersonIdno;
+  }
+
+  public void setOldLegalPersonIdno(String oldLegalPersonIdno) {
+    this.oldLegalPersonIdno = oldLegalPersonIdno;
+  }
+
+  public String getOldContactman() {
+    return oldContactman;
+  }
+
+  public void setOldContactman(String oldContactman) {
+    this.oldContactman = oldContactman;
+  }
+
+  public String getOldMobile() {
+    return oldMobile;
+  }
+
+  public void setOldMobile(String oldMobile) {
+    this.oldMobile = oldMobile;
+  }
+
+  public String getOldEmail() {
+    return oldEmail;
+  }
+
+  public void setOldEmail(String oldEmail) {
+    this.oldEmail = oldEmail;
+  }
+
+  public String getOldTel() {
+    return oldTel;
+  }
+
+  public void setOldTel(String oldTel) {
+    this.oldTel = oldTel;
+  }
+
+  public Integer getOldFshopid() {
+    return oldFshopid;
+  }
+
+  public void setOldFshopid(Integer oldFshopid) {
+    this.oldFshopid = oldFshopid;
+  }
+}
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 af225dd..3d1a963 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
@@ -1,25 +1,30 @@
 package com.supwisdom.dlpay.system.controller;
 
+import com.supwisdom.dlpay.api.annotation.ShopType;
 import com.supwisdom.dlpay.api.bean.JsonResult;
 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.types.IDTypes;
 import com.supwisdom.dlpay.api.types.ShopTypes;
-import com.supwisdom.dlpay.framework.domain.TDictionary;
-import com.supwisdom.dlpay.framework.domain.TShop;
-import com.supwisdom.dlpay.framework.domain.TShopacc;
+import com.supwisdom.dlpay.framework.domain.*;
 import com.supwisdom.dlpay.framework.service.SystemUtilService;
 import com.supwisdom.dlpay.framework.util.*;
+import com.supwisdom.dlpay.system.bean.ShopCheckBean;
 import com.supwisdom.dlpay.system.bean.ShopConfigBean;
+import com.supwisdom.dlpay.system.bean.TreeSelectNode;
 import com.supwisdom.dlpay.system.service.DictionaryProxy;
 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.apache.commons.lang.math.NumberUtils;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.security.core.annotation.AuthenticationPrincipal;
+import org.springframework.security.core.userdetails.UserDetails;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
 import org.springframework.web.bind.annotation.*;
@@ -43,33 +48,60 @@
 
   @GetMapping("/shop/index")
   public String shopView(Model model) {
-    model.addAttribute(Dictionary.IDTYPE,
-        dictionaryProxy.<TDictionary>getDictionaryAsList(Dictionary.IDTYPE));
+    model.addAttribute("shopNeedCheck", systemUtilService.getSysparaValueAsBoolean(SysparaUtil.SHOP_NEEDCHECK_SWITCH));
     return "system/shop/index";
   }
 
   @GetMapping("/shop/shoptree")
   @PreAuthorize("hasPermission('/shop/index','')")
   @ResponseBody
-  public JsonResult shopTreeData() {
-    return JsonResult.ok("OK").put("data", shopDataService.getAllShopNodes());
+  public JsonResult shopTreeData(@AuthenticationPrincipal UserDetails operUser) {
+    try {
+      TOperator oper = (TOperator) operUser;
+      return JsonResult.ok("OK").put("data", shopDataService.getShopManageLayerShopTree(oper.getOperid()));
+    } catch (Exception e) {
+      return JsonResult.error("查询商户树失败!").put("exception", e);
+    }
+  }
+
+  @GetMapping("/shop/shoplist")
+  @PreAuthorize("hasPermission('/shop/index','')")
+  @ResponseBody
+  public PageResult<TShop> getShopBySearch(@RequestParam("page") Integer pageNo,
+                                           @RequestParam("limit") Integer pageSize,
+                                           @RequestParam(value = "status", required = false) String status,
+                                           @RequestParam(value = "shopname", required = false) String shopname,
+                                           @RequestParam(value = "shopid", required = false) Integer shopid) {
+    try {
+      if (null == pageNo || pageNo < 1) pageNo = WebConstant.PAGENO_DEFAULT;
+      if (null == pageSize || pageSize < 1) pageSize = WebConstant.PAGESIZE_DEFAULT;
+      return shopDataService.getShopListBySearch(status, shopname, shopid, pageNo, pageSize);
+    } catch (Exception e) {
+      e.printStackTrace();
+      return new PageResult<>(99, "系统查询错误");
+    }
   }
 
   @PostMapping("/shop/deleteshop")
   @PreAuthorize("hasPermission('/shop/deleteshop','')")
   @ResponseBody
-  public JsonResult deleteShop(@RequestParam("shopid") Integer shopid) {
+  public JsonResult deleteShop(@RequestParam("shopid") Integer shopid,
+                               @AuthenticationPrincipal UserDetails operUser) {
     TShop shop = shopDataService.getShopByShopid(shopid);
     if (null == shop) {
       return JsonResult.error("商户不存在,请重新查询");  //商户不存在,请重新查询
     }
 
     try {
-      if (shopDataService.deleteShop(shop)) {
+      TOperator oper = (TOperator) operUser;
+      boolean needCheck = systemUtilService.getSysparaValueAsBoolean(SysparaUtil.SHOP_NEEDCHECK_SWITCH);
+      int ret = shopDataService.deleteShop(shop, needCheck, oper);
+      if (0 == ret) {
         return JsonResult.ok("删除成功");
-      } else {
-        return JsonResult.error("删除失败");
+      } else if (ret > 0) {
+        return JsonResult.ok("删除申请成功");
       }
+      return JsonResult.error(needCheck ? "删除申请失败" : "删除失败");
     } catch (WebCheckException ex) {
       return JsonResult.error(ex.getMessage());
     } catch (Exception e) {
@@ -77,79 +109,264 @@
     }
   }
 
-  @GetMapping("/shop/getshopinfo")
-  @PreAuthorize("hasPermission('/shop/getshopinfo','')")
-  @ResponseBody
-  public JsonResult getShopInfo(@RequestParam("shopid") Integer shopid) {
-    TShop shop = shopDataService.getShopByShopid(shopid);
-    if (null == shop) {
-      return JsonResult.error("商户不存在,请重新查询");  //商户不存在,请重新查询
-    }
-    return JsonResult.ok("查询成功").put("shop", shop);
+  @GetMapping("/shop/load4addshop")
+  @PreAuthorize("hasPermission('/shop/load4addshop','')")
+  public String load4AddShop(Model model) {
+    model.addAttribute(Dictionary.IDTYPE, dictionaryProxy.<TDictionary>getDictionaryAsList(Dictionary.IDTYPE));
+    return "system/shop/addshop";
   }
 
-  @PostMapping("/shop/saveorupdate")
-  @PreAuthorize("hasPermission('/shop/saveorupdate','')")
+  @GetMapping("/shop/selectshopgroup")
+  @PreAuthorize("hasPermission('/shop/index','')")
   @ResponseBody
-  public JsonResult saveOrUpdateShop(@RequestParam("shopid") Integer shopid, @RequestParam("shopname") String shopname,
-                                     @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,
-                                     @RequestParam(value = "mobile", required = false) String mobile,
-                                     @RequestParam(value = "tel", required = false) String tel,
-                                     @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
-        || !shopTypeCheck.isInEnums(shoptype, ShopTypes.NORMAL, ShopTypes.GROUP, ShopTypes.ROOT)) {
-      return JsonResult.error("参数传递错误");
-    }
+  public List<TreeSelectNode> searchShopTree() {
+    return shopDataService.getChooseShopGroup();
+  }
 
-    TShop shop;
-    boolean addflag = false;
-    if (shopid == 0) {
-      //新增
-      addflag = true;
-      shop = new TShop();
-      shop.setFshopid(fshopid);
-      shop.setShopname(shopname);
-      shop.setShoptype(shoptype);
-      shop.setStatus(TradeDict.STATUS_NORMAL);
-    } else {
-      //修改
-      shop = shopDataService.getShopByShopid(shopid);
-      if (null == shop) {
-        return JsonResult.error("商户不存在,修改失败!请重新查询");
-      }
-      shop.setFshopid(fshopid);
-      shop.setShopname(shopname);
+
+  @PostMapping("/shop/addshop")
+  @PreAuthorize("hasPermission('/shop/addshop','')")
+  @ResponseBody
+  public JsonResult addShop(@RequestParam("shoptype") String shoptype,
+                            @RequestParam("fshopid") Integer fshopid,
+                            @RequestParam("shopname") String shopname,
+                            @RequestParam("businessLicenseNo") String businessLicenseNo,
+                            @RequestParam("taxRegistrationNo") String taxRegistrationNo,
+                            @RequestParam("addr") String addr,
+                            @RequestParam("legalPersonName") String legalPersonName,
+                            @RequestParam("legalPersonIdtype") String legalPersonIdtype,
+                            @RequestParam("legalPersonIdno") String legalPersonIdno,
+                            @RequestParam("contactman") String contactman,
+                            @RequestParam("mobile") String mobile,
+                            @RequestParam("email") String email,
+                            @RequestParam("tel") String tel,
+                            @AuthenticationPrincipal UserDetails operUser) {
+    if (StringUtil.isEmpty(shopname) || null == fshopid || !shopTypeCheck.isInEnums(shoptype, ShopTypes.NORMAL, ShopTypes.GROUP, ShopTypes.ROOT)) {
+      return JsonResult.error("参数传递错误");
+    } else if (ShopTypes.NORMAL.toString().equals(shoptype) && (StringUtil.isEmpty(businessLicenseNo) || StringUtil.isEmpty(taxRegistrationNo)
+        || StringUtil.isEmpty(addr) || StringUtil.isEmpty(legalPersonName) || StringUtil.isEmpty(legalPersonIdtype) || StringUtil.isEmpty(legalPersonIdno))) {
+      return JsonResult.error("参数传递错误,结算商户必须填写商户营业信息!");
     }
-    shop.setContactman(contactman == null ? null : contactman.trim());
-    shop.setIdno(idno == null ? null : idno.trim());
-    shop.setIdtype(idtype == null ? null : idtype.trim());
-    if (!StringUtil.isEmpty(shop.getIdno()) && StringUtil.isEmpty(shop.getIdtype())) {
-      return JsonResult.error("填写证件号时必须制定证件类型!");
-    } else if (!StringUtil.isEmpty(shop.getIdno()) && IDTypes.IDCARD.value().equals(shop.getIdtype()) && !StringUtil.isIdentity(shop.getIdno())) {
+    TShop shop = new TShop();
+    shop.setFshopid(fshopid);
+    shop.setShopname(shopname);
+    shop.setShoptype(shoptype);
+    shop.setBusinessLicenseNo(null == businessLicenseNo ? null : businessLicenseNo.trim());
+    shop.setTaxRegistrationNo(null == taxRegistrationNo ? null : taxRegistrationNo.trim());
+    shop.setAddr(null == addr ? null : addr.trim());
+    shop.setLegalPersonName(null == legalPersonName ? null : legalPersonName.trim());
+    shop.setLegalPersonIdtype(null == legalPersonIdtype ? null : legalPersonIdtype.trim());
+    shop.setLegalPersonIdno(null == legalPersonIdno ? null : legalPersonIdno);
+    if (!StringUtil.isEmpty(shop.getLegalPersonIdno()) && StringUtil.isEmpty(shop.getLegalPersonIdtype())) {
+      return JsonResult.error("填写法人证件号时必须指定证件类型!");
+    } else if (!StringUtil.isEmpty(shop.getLegalPersonIdno()) && IDTypes.IDCARD.value().equals(shop.getLegalPersonIdtype()) && !StringUtil.isIdentity(shop.getLegalPersonIdno())) {
       return JsonResult.error("身份证格式错误!");
     }
+    shop.setContactman(contactman == null ? null : contactman.trim());
     shop.setMobile(mobile);
     if (!StringUtil.isEmpty(shop.getMobile()) && !StringUtil.isMobile(shop.getMobile())) {
-      return JsonResult.error("请正确填写手机号!");
+      return JsonResult.error("请正确填写联系人手机号!");
     }
     shop.setTel(tel == null ? null : tel.trim());
     shop.setEmail(email == null ? null : email.trim());
     if (!StringUtil.isEmpty(shop.getEmail()) && !StringUtil.isEmail(shop.getEmail())) {
-      return JsonResult.error("请正确填写邮箱地址!");
+      return JsonResult.error("请正确填写联系人邮箱!");
     }
-    shop.setAddr(addr == null ? null : addr.trim());
-    shop.setZipcode(zipcode == null ? null : zipcode.trim());
 
     try {
-      if (shopDataService.saveOrUpdateShop(shop)) {
-        return JsonResult.ok(addflag ? "新增成功" : "修改成功").put("shop", shop);
+      TOperator oper = (TOperator) operUser;
+      boolean needCheck = systemUtilService.getSysparaValueAsBoolean(SysparaUtil.SHOP_NEEDCHECK_SWITCH);
+      int ret = shopDataService.saveNewShop(shop, needCheck, oper);
+      if (ret == 0) {
+        return JsonResult.ok("新增成功!");
+      } else if (ret > 0) {
+        return JsonResult.ok("新增申请成功!");
+      }
+      return JsonResult.error(needCheck ? "新增申请失败" : "新增失败");
+    } catch (WebCheckException ex) {
+      return JsonResult.error(ex.getMessage());
+    } catch (Exception e) {
+      e.printStackTrace();
+      return JsonResult.error("系统处理异常").put("exception", e);
+    }
+  }
+
+  @GetMapping("/shop/load4updateshop")
+  @PreAuthorize("hasPermission('/shop/load4updateshop','')")
+  public String load4UpdateShop(@RequestParam("shopid") Integer shopid, Model model) {
+    TShop shop = shopDataService.getShopByShopid(shopid);
+    model.addAttribute("shop", shop != null ? shop : new TShop());
+    model.addAttribute(Dictionary.IDTYPE, dictionaryProxy.<TDictionary>getDictionaryAsList(Dictionary.IDTYPE));
+    return "system/shop/updateshop";
+  }
+
+  @PostMapping("/shop/updateshop")
+  @PreAuthorize("hasPermission('/shop/updateshop','')")
+  @ResponseBody
+  public JsonResult updateShop(@RequestParam("shopid") Integer shopid,
+                            @RequestParam("fshopid") Integer fshopid,
+                            @RequestParam("shopname") String shopname,
+                            @RequestParam("businessLicenseNo") String businessLicenseNo,
+                            @RequestParam("taxRegistrationNo") String taxRegistrationNo,
+                            @RequestParam("addr") String addr,
+                            @RequestParam("legalPersonName") String legalPersonName,
+                            @RequestParam("legalPersonIdtype") String legalPersonIdtype,
+                            @RequestParam("legalPersonIdno") String legalPersonIdno,
+                            @RequestParam("contactman") String contactman,
+                            @RequestParam("mobile") String mobile,
+                            @RequestParam("email") String email,
+                            @RequestParam("tel") String tel,
+                            @AuthenticationPrincipal UserDetails operUser) {
+    if (null == shopid || StringUtil.isEmpty(shopname) || null == fshopid) {
+      return JsonResult.error("参数传递错误");
+    }
+    TShop oldShop = shopDataService.getShopByShopid(shopid);
+    if (null == oldShop) {
+      return JsonResult.error("商户不存在,修改失败!请重新查询");
+    }
+    if (ShopTypes.NORMAL.toString().equals(oldShop.getShoptype()) && (StringUtil.isEmpty(businessLicenseNo) || StringUtil.isEmpty(taxRegistrationNo)
+        || StringUtil.isEmpty(addr) || StringUtil.isEmpty(legalPersonName) || StringUtil.isEmpty(legalPersonIdtype) || StringUtil.isEmpty(legalPersonIdno))) {
+      return JsonResult.error("参数传递错误,结算商户必须填写商户营业信息!");
+    }
+
+    TShop shop=new TShop();
+    BeanUtils.copyProperties(oldShop, shop); //TODO:避免JPA的set方法会提交数据库
+    shop.setFshopid(fshopid);
+    shop.setShopname(shopname);
+    shop.setBusinessLicenseNo(null == businessLicenseNo ? null : businessLicenseNo.trim());
+    shop.setTaxRegistrationNo(null == taxRegistrationNo ? null : taxRegistrationNo.trim());
+    shop.setAddr(null == addr ? null : addr.trim());
+    shop.setLegalPersonName(null == legalPersonName ? null : legalPersonName.trim());
+    shop.setLegalPersonIdtype(null == legalPersonIdtype ? null : legalPersonIdtype.trim());
+    shop.setLegalPersonIdno(null == legalPersonIdno ? null : legalPersonIdno);
+    if (!StringUtil.isEmpty(shop.getLegalPersonIdno()) && StringUtil.isEmpty(shop.getLegalPersonIdtype())) {
+      return JsonResult.error("填写法人证件号时必须指定证件类型!");
+    } else if (!StringUtil.isEmpty(shop.getLegalPersonIdno()) && IDTypes.IDCARD.value().equals(shop.getLegalPersonIdtype()) && !StringUtil.isIdentity(shop.getLegalPersonIdno())) {
+      return JsonResult.error("身份证格式错误!");
+    }
+    shop.setContactman(contactman == null ? null : contactman.trim());
+    shop.setMobile(mobile);
+    if (!StringUtil.isEmpty(shop.getMobile()) && !StringUtil.isMobile(shop.getMobile())) {
+      return JsonResult.error("请正确填写联系人手机号!");
+    }
+    shop.setTel(tel == null ? null : tel.trim());
+    shop.setEmail(email == null ? null : email.trim());
+    if (!StringUtil.isEmpty(shop.getEmail()) && !StringUtil.isEmail(shop.getEmail())) {
+      return JsonResult.error("请正确填写联系人邮箱!");
+    }
+
+    try {
+      TOperator oper = (TOperator) operUser;
+      boolean needCheck = systemUtilService.getSysparaValueAsBoolean(SysparaUtil.SHOP_NEEDCHECK_SWITCH);
+      int ret = shopDataService.updateShop(shop, needCheck, oper);
+      if (ret == 0) {
+        return JsonResult.ok("修改成功!");
+      } else if (ret > 0) {
+        return JsonResult.ok("修改申请成功!");
+      }
+      return JsonResult.error(needCheck ? "修改申请失败" : "修改失败");
+    } catch (WebCheckException ex) {
+      return JsonResult.error(ex.getMessage());
+    } catch (Exception e) {
+      e.printStackTrace();
+      return JsonResult.error("系统处理异常").put("exception", e);
+    }
+  }
+
+  @GetMapping("/shop/getshopinfo")
+  @PreAuthorize("hasPermission('/shop/getshopinfo','')")
+  public String getShopInfo(@RequestParam("shopid") Integer shopid,Model model) {
+    TShop shop = shopDataService.getShopByShopid(shopid);
+    model.addAttribute("shop", shop != null ? shop : new TShop());
+    model.addAttribute(Dictionary.IDTYPE, dictionaryProxy.<TDictionary>getDictionaryAsList(Dictionary.IDTYPE));
+    return "system/shop/shopdetail";
+  }
+
+  @GetMapping("/shop/getshopchk")
+  @PreAuthorize("hasPermission('/shop/getshopchk','')")
+  public String getShopChkdtl(@RequestParam("shopid") Integer shopid,Model model) {
+    model.addAttribute("selectShopid", shopid);
+    return "system/shop/shopchk";
+  }
+
+  @GetMapping("/shop/getshopchklist")
+  @PreAuthorize("hasPermission('/shop/getshopchk','')")
+  @ResponseBody
+  public PageResult<TOperChkdtl> getShopBySearch(@RequestParam("page") Integer pageNo,
+                                                 @RequestParam("limit") Integer pageSize,
+                                                 @RequestParam(value = "shopid", required = false) String shopid,
+                                                 @RequestParam(value = "status", required = false) String status,
+                                                 @RequestParam(value = "searchkey", required = false) String searchkey) {
+    try {
+      if (StringUtil.isEmpty(shopid)) return new PageResult<>(99, "无数据");
+      if (null == pageNo || pageNo < 1) pageNo = WebConstant.PAGENO_DEFAULT;
+      if (null == pageSize || pageSize < 1) pageSize = WebConstant.PAGESIZE_DEFAULT;
+      return shopDataService.getShopChkdtlDetails(shopid, status, searchkey, pageNo, pageSize);
+    } catch (Exception e) {
+      e.printStackTrace();
+      return new PageResult<>(99, "系统查询错误");
+    }
+  }
+
+  /**
+   * ====================================================
+   * 商户审批
+   * ====================================================
+   */
+  @GetMapping("/shop/shopcheck")
+  @PreAuthorize("hasPermission('/shop/shopcheck','')")
+  public String shopCheckIndex(){
+    return "system/shop/shopcheck";
+  }
+
+  @GetMapping("/shop/shopchecklist")
+  @PreAuthorize("hasPermission('/shop/shopcheck','')")
+  @ResponseBody
+  public PageResult<TOperChkdtl> shopCheckIndex(@RequestParam("page") Integer pageNo,
+                                                @RequestParam("limit") Integer pageSize,
+                                                @RequestParam(value = "shopid", required = false) String shopid,
+                                                @RequestParam(value = "status", required = false) String status,
+                                                @RequestParam(value = "searchkey", required = false) String searchkey) {
+    try {
+      if (null == pageNo || pageNo < 1) pageNo = WebConstant.PAGENO_DEFAULT;
+      if (null == pageSize || pageSize < 1) pageSize = WebConstant.PAGESIZE_DEFAULT;
+      return shopDataService.getShopChkdtlDetails(shopid, status, searchkey, pageNo, pageSize);
+    } catch (Exception e) {
+      e.printStackTrace();
+      return new PageResult<>(99, "系统查询错误");
+    }
+  }
+
+  @GetMapping("/shop/opercheck")
+  @PreAuthorize("hasPermission('/shop/opercheck','')")
+  public String shopOperCheck(@RequestParam("chkno") Long chkno, Model map) {
+    TOperChkdtl chkdtl = shopDataService.getOperChkdtlByChkno(chkno);
+    ShopCheckBean shop = shopDataService.getOperChkShopInfo(chkdtl);
+    map.addAttribute("operChkdtl", chkdtl);
+    map.addAttribute("shop", shop);
+    return "system/shop/opercheck";
+  }
+
+  @PostMapping("/shop/docheckshop")
+  @PreAuthorize("hasPermission('/shop/docheckshop','')")
+  @ResponseBody
+  public JsonResult doCheckShop(@RequestParam("chkno") String chkno,
+                                @RequestParam("chkresult") String chkresult,
+                                @RequestParam("chkmsg") String chkmsg,
+                                @AuthenticationPrincipal UserDetails operUser) {
+    if(!NumberUtils.isDigits(chkno) || (!TradeDict.STATUS_NORMAL.equals(chkresult) && !TradeDict.STATUS_REJECT.equals(chkresult))){
+      return JsonResult.error("参数传递错误");
+    }else if(!TradeDict.STATUS_NORMAL.equals(chkresult) && StringUtil.isEmpty(chkmsg)){
+      return JsonResult.error("驳回必须填写审核意见!");
+    }
+
+    try {
+      TOperator oper = (TOperator) operUser;
+      TOperChkdtl chkdtl = shopDataService.doCheckShopChkdtl(Long.valueOf(chkno), TradeDict.STATUS_NORMAL.equals(chkresult), chkmsg, oper);
+      if (chkresult.equals(chkdtl.getChkResult())) {
+        return JsonResult.ok(TradeDict.STATUS_NORMAL.equals(chkresult) ? "审核成功!" : "驳回成功!");
       } else {
-        return JsonResult.error(addflag ? "新增失败" : "修改失败");
+        return JsonResult.ok(299, chkdtl.getChkMsg());
       }
     } catch (WebCheckException ex) {
       return JsonResult.error(ex.getMessage());
@@ -159,6 +376,77 @@
     }
   }
 
+//  @PostMapping("/shop/saveorupdate")
+//  @PreAuthorize("hasPermission('/shop/saveorupdate','')")
+//  @ResponseBody
+//  public JsonResult saveOrUpdateShop(@RequestParam("shopid") Integer shopid, @RequestParam("shopname") String shopname,
+//                                     @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,
+//                                     @RequestParam(value = "mobile", required = false) String mobile,
+//                                     @RequestParam(value = "tel", required = false) String tel,
+//                                     @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
+//        || !shopTypeCheck.isInEnums(shoptype, ShopTypes.NORMAL, ShopTypes.GROUP, ShopTypes.ROOT)) {
+//      return JsonResult.error("参数传递错误");
+//    }
+//
+//    TShop shop;
+//    boolean addflag = false;
+//    if (shopid == 0) {
+//      //新增
+//      addflag = true;
+//      shop = new TShop();
+//      shop.setFshopid(fshopid);
+//      shop.setShopname(shopname);
+//      shop.setShoptype(shoptype);
+//      shop.setStatus(TradeDict.STATUS_NORMAL);
+//    } else {
+//      //修改
+//      shop = shopDataService.getShopByShopid(shopid);
+//      if (null == shop) {
+//        return JsonResult.error("商户不存在,修改失败!请重新查询");
+//      }
+//      shop.setFshopid(fshopid);
+//      shop.setShopname(shopname);
+//    }
+//    shop.setContactman(contactman == null ? null : contactman.trim());
+//    shop.setIdno(idno == null ? null : idno.trim());
+//    shop.setIdtype(idtype == null ? null : idtype.trim());
+//    if (!StringUtil.isEmpty(shop.getIdno()) && StringUtil.isEmpty(shop.getIdtype())) {
+//      return JsonResult.error("填写证件号时必须制定证件类型!");
+//    } else if (!StringUtil.isEmpty(shop.getIdno()) && IDTypes.IDCARD.value().equals(shop.getIdtype()) && !StringUtil.isIdentity(shop.getIdno())) {
+//      return JsonResult.error("身份证格式错误!");
+//    }
+//    shop.setMobile(mobile);
+//    if (!StringUtil.isEmpty(shop.getMobile()) && !StringUtil.isMobile(shop.getMobile())) {
+//      return JsonResult.error("请正确填写手机号!");
+//    }
+//    shop.setTel(tel == null ? null : tel.trim());
+//    shop.setEmail(email == null ? null : email.trim());
+//    if (!StringUtil.isEmpty(shop.getEmail()) && !StringUtil.isEmail(shop.getEmail())) {
+//      return JsonResult.error("请正确填写邮箱地址!");
+//    }
+//    shop.setAddr(addr == null ? null : addr.trim());
+//    shop.setZipcode(zipcode == null ? null : zipcode.trim());
+//
+//    try {
+//      if (shopDataService.saveOrUpdateShop(shop)) {
+//        return JsonResult.ok(addflag ? "新增成功" : "修改成功").put("shop", shop);
+//      } else {
+//        return JsonResult.error(addflag ? "新增失败" : "修改失败");
+//      }
+//    } catch (WebCheckException ex) {
+//      return JsonResult.error(ex.getMessage());
+//    } catch (Exception e) {
+//      e.printStackTrace();
+//      return JsonResult.error("系统处理异常").put("exception", e);
+//    }
+//  }
+
   /**
    * ====================================================
    * 商户支付能力配置
@@ -166,7 +454,6 @@
    */
   @GetMapping("/shop/config")
   public String shopConfigView(Model model) {
-//    model.addAttribute("paytypelist", shopDataService.getConsumePaytypes());
     model.addAttribute(Dictionary.PAY_TYPE,
         dictionaryProxy.<TSourceType>getDictionaryAsList(Dictionary.SOURCE_TYPE));
     return "system/shop/config";
diff --git a/payapi/src/main/java/com/supwisdom/dlpay/system/service/ShopDataService.java b/payapi/src/main/java/com/supwisdom/dlpay/system/service/ShopDataService.java
index 40e58d3..31531d1 100644
--- a/payapi/src/main/java/com/supwisdom/dlpay/system/service/ShopDataService.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/system/service/ShopDataService.java
@@ -2,12 +2,12 @@
 
 import com.supwisdom.dlpay.api.domain.TShopSourceType;
 import com.supwisdom.dlpay.api.domain.TShopSourceTypeConfig;
+import com.supwisdom.dlpay.framework.domain.TOperChkdtl;
+import com.supwisdom.dlpay.framework.domain.TOperator;
 import com.supwisdom.dlpay.framework.domain.TShop;
 import com.supwisdom.dlpay.framework.domain.TShopacc;
 import com.supwisdom.dlpay.framework.util.PageResult;
-import com.supwisdom.dlpay.system.bean.LayerTreeNode;
-import com.supwisdom.dlpay.system.bean.ShopConfigBean;
-import com.supwisdom.dlpay.system.bean.ZTreeNode;
+import com.supwisdom.dlpay.system.bean.*;
 import com.supwisdom.dlpay.util.WebCheckException;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
@@ -23,7 +23,13 @@
   TShop getShopByShopid(Integer shopid);
 
   @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
-  boolean deleteShop(TShop shop) throws WebCheckException;
+  int deleteShop(TShop shop, boolean needCheck, TOperator oper) throws WebCheckException;
+
+  @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
+  int saveNewShop(TShop shop, boolean needCheck, TOperator oper) throws WebCheckException;
+
+  @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
+  int updateShop(TShop shop, boolean needCheck, TOperator oper) throws WebCheckException;
 
   @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
   boolean saveOrUpdateShop(TShop shop) throws WebCheckException;
@@ -48,4 +54,26 @@
 
   @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class,readOnly = true)
   List<LayerTreeNode> getLayerShopTree();
+
+  @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class,readOnly = true)
+  List<LayerTreeNode> getShopManageLayerShopTree(String operid);
+
+  @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class,readOnly = true)
+  PageResult<TShop> getShopListBySearch(String status, String shopname, Integer shopid, int pageNo, int pageSize);
+
+  @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
+  List<TreeSelectNode> getChooseShopGroup();
+
+  @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
+  PageResult<TOperChkdtl> getShopChkdtlDetails(String shopid, String status, String searchkey, int pageNo, int pageSize);
+
+  @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
+  TOperChkdtl getOperChkdtlByChkno(Long chkno);
+
+  @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
+  ShopCheckBean getOperChkShopInfo(TOperChkdtl chkdtl);
+
+  @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
+  TOperChkdtl doCheckShopChkdtl(Long chkno,boolean passflag, String chkmsg, TOperator oper) throws Exception;
+
 }
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 427e64f..1cccf99 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
@@ -1,5 +1,6 @@
 package com.supwisdom.dlpay.system.service.impl;
 
+import com.google.gson.Gson;
 import com.supwisdom.dlpay.api.dao.SourceTypeConfigDao;
 import com.supwisdom.dlpay.api.dao.SourceTypeDao;
 import com.supwisdom.dlpay.api.dao.ShopSourceTypeConfigDao;
@@ -9,20 +10,21 @@
 import com.supwisdom.dlpay.api.domain.TShopSourceType;
 import com.supwisdom.dlpay.api.domain.TShopSourceTypeConfig;
 import com.supwisdom.dlpay.api.types.ShopTypes;
+import com.supwisdom.dlpay.framework.dao.DictionaryDao;
+import com.supwisdom.dlpay.framework.dao.OperChkdtlDao;
 import com.supwisdom.dlpay.framework.dao.ShopDao;
 import com.supwisdom.dlpay.framework.dao.ShopaccDao;
 import com.supwisdom.dlpay.framework.data.SystemDateTime;
-import com.supwisdom.dlpay.framework.domain.TShop;
-import com.supwisdom.dlpay.framework.domain.TShopacc;
+import com.supwisdom.dlpay.framework.domain.*;
 import com.supwisdom.dlpay.framework.service.SystemUtilService;
 import com.supwisdom.dlpay.framework.tenant.TenantContext;
 import com.supwisdom.dlpay.framework.util.*;
-import com.supwisdom.dlpay.system.bean.LayerTreeNode;
-import com.supwisdom.dlpay.system.bean.ShopConfigBean;
-import com.supwisdom.dlpay.system.bean.ZTreeNode;
+import com.supwisdom.dlpay.system.bean.*;
 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.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.PageRequest;
@@ -31,6 +33,8 @@
 import org.springframework.stereotype.Service;
 import org.springframework.data.jpa.domain.Specification;
 
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
 import javax.persistence.criteria.*;
 import java.util.ArrayList;
 import java.util.List;
@@ -52,6 +56,12 @@
   private SourceTypeConfigDao sourceTypeConfigDao;
   @Autowired
   private ShopSourceTypeConfigDao shopPaytypeConfigDao;
+  @Autowired
+  private OperChkdtlDao operChkdtlDao;
+  @Autowired
+  private DictionaryDao dictionaryDao;
+  @PersistenceContext
+  private EntityManager entityManager;
 
   private EnumCheck<ShopTypes, String> enumUtil = new EnumCheck<>();
 
@@ -87,27 +97,210 @@
   }
 
   @Override
-  public boolean deleteShop(TShop shop) throws WebCheckException {
+  public int deleteShop(TShop shop, boolean needCheck, TOperator oper) throws WebCheckException {
     if (null != shop) {
       if (ShopTypes.ROOT.value().equals(shop.getShoptype())) {
         throw new WebCheckException("不能删除根商户节点");
       }
+      if (TradeDict.STATUS_CLOSED.equals(shop.getStatus())) {
+        throw new WebCheckException("商户已经被删除,请重新查询再操作");
+      }
       List<TShop> childShops = shopDao.getChildShopsByShopid(shop.getShopid());
       if (!StringUtil.isEmpty(childShops))
         throw new WebCheckException("请先删除下级商户");
-      shop.setStatus(TradeDict.STATUS_CLOSED);
-      shop.setClosedate(systemUtilService.getSysdatetime().getHostdate());
-      shopDao.save(shop);
+      TShopacc shopacc = null;
       if (!StringUtil.isEmpty(shop.getShopaccno())) {
-        TShopacc shopacc = shopaccDao.getByShopaccno(shop.getShopaccno());
+        shopacc = shopaccDao.getByShopaccno(shop.getShopaccno());
         if (null == shopacc) throw new WebCheckException("数据异常!对应的商户账户不存在!");
-        shopacc.setStatus(TradeDict.STATUS_CLOSED);
-        shopacc.setClosedate(shop.getClosedate());
-        shopaccDao.save(shopacc);
       }
-      return true;
+
+      if (!needCheck) {
+        //无需审批,直接注销
+        shop.setStatus(TradeDict.STATUS_CLOSED);
+        shop.setClosedate(systemUtilService.getSysdatetime().getHostdate());
+        shopDao.save(shop);
+        if (null != shopacc) {
+          shopacc.setStatus(TradeDict.STATUS_CLOSED);
+          shopacc.setClosedate(shop.getClosedate());
+          shopaccDao.save(shopacc);
+        }
+        return 0;
+      } else {
+        //创建审批记录
+        if (TradeDict.STATUS_NORMAL.equals(shop.getStatus())) {
+          if (operChkdtlDao.getChkdtlCount(ConstantUtil.OPERCHK_CHKTYPE_SHOP, ConstantUtil.OPERCHK_CHKMODE_DELETE, shop.getShopid().toString(), TradeDict.STATUS_UNCHECK).getExisted() > 0) {
+            throw new WebCheckException("该商户已经提交了删除申请,无需再次提交!");
+          }
+          TOperChkdtl chkdtl = new TOperChkdtl();
+          chkdtl.setChkType(ConstantUtil.OPERCHK_CHKTYPE_SHOP);
+          chkdtl.setChkMode(ConstantUtil.OPERCHK_CHKMODE_DELETE);
+          chkdtl.setContentId(shop.getShopid().toString());
+          chkdtl.setChkResult(TradeDict.STATUS_UNCHECK);
+          chkdtl.setCreateOperid(oper.getOperid());
+          chkdtl.setCreateOpername(oper.getOpername());
+          chkdtl.setCreatetime(systemUtilService.getSysdatetime().getHostdatetime());
+          chkdtl.setTenantId(shop.getTenantId());
+          operChkdtlDao.save(chkdtl);
+          return 1;
+        } else {
+          //未审批或被驳回的商户直接删除,未审核的审批直接作废
+          operChkdtlDao.doClearChkdtl(ConstantUtil.OPERCHK_CHKTYPE_SHOP, shop.getShopid().toString());
+          shopDao.delete(shop);
+          if (null != shopacc) {
+            shopaccDao.delete(shopacc);
+          }
+          return 0;
+        }
+      }
     }
-    return false;
+    return -1;
+  }
+
+  @Override
+  public int saveNewShop(TShop shop, boolean needCheck, TOperator oper) throws WebCheckException {
+    if (null == shop) return -1;
+    if (shop.getFshopid() != 0) {
+      TShop fshop = shopDao.getTShopByShopid(shop.getFshopid());
+      if (null == fshop) {
+        throw new WebCheckException("上级商户不存在!");
+      } else if (!enumUtil.isInEnums(fshop.getShoptype(),
+          ShopTypes.ROOT, ShopTypes.GROUP)) {
+        throw new WebCheckException("上级商户不是商户组!");
+      }
+    }
+    if (shopDao.checkShopnameExist(shop.getShopname(), shop.getFshopid(), shop.getShopid() == null ? 0 : shop.getShopid()) > 0) {
+      throw new WebCheckException("商户名称在同级下已经存在!");
+    }
+
+    SystemDateTime dt = systemUtilService.getSysdatetime();
+    shop.setOpendate(dt.getHostdate());
+    shop.setTenantId(TenantContext.getTenantSchema());
+    shop.setAddOperid(oper == null ? null : oper.getOperid());
+    if (!needCheck) {
+      //不需要审核
+      shop.setStatus(TradeDict.STATUS_NORMAL);
+      shopDao.save(shop);
+      if (enumUtil.isInEnums(shop.getShoptype(), ShopTypes.NORMAL)) {
+        TShopacc shopacc = new TShopacc();
+        shopacc.setShopaccno(String.format("2%09d", shop.getShopid()));
+        shopacc.setShopid(shop.getShopid());
+        shopacc.setShopname(shop.getShopname());
+        shopacc.setSubjno(Subject.SUBJNO_MACHANT_INCOME);
+        shopacc.setStatus(TradeDict.STATUS_NORMAL);
+        shopacc.setOpendate(dt.getHostdate());
+        shopacc.setBalance(0D);
+        shopacc.setTenantId(shop.getTenantId());
+        shopacc = shopaccDao.save(shopacc);
+        shopacc.setMac(shopacc.genMAC());
+        shopaccDao.save(shopacc);
+        shop.setShopaccno(shopacc.getShopaccno());
+        shopDao.save(shop);
+
+//        TShopPaytype shopPaytype = new TShopPaytype();
+//        shopPaytype.setShopaccno(shopacc.getShopaccno());
+//        shopPaytype.setSourceType(TradeDict.PAYTYPE_BALANCE);
+//        shopPaytype.setConsumeEnable(true);
+//        shopPaytype.setAnonymousEnable(false);
+//        shopPaytype.setReverseEnable(false);
+//        shopPaytype.setCreatetime(dt.getHostdatetime());
+//        shopSourceTypeDao.save(shopPaytype); //默认增加余额支付方式
+      }
+      return 0;
+
+    } else {
+      //需要审核
+      shop.setStatus(TradeDict.STATUS_UNCHECK);
+      shop = shopDao.save(shop);
+
+      TOperChkdtl chkdtl = new TOperChkdtl();
+      chkdtl.setChkType(ConstantUtil.OPERCHK_CHKTYPE_SHOP);
+      chkdtl.setChkMode(ConstantUtil.OPERCHK_CHKMODE_ADD);
+      chkdtl.setContentId(shop.getShopid().toString());
+      chkdtl.setChkResult(TradeDict.STATUS_UNCHECK);
+      chkdtl.setCreateOperid(oper.getOperid());
+      chkdtl.setCreateOpername(oper.getOpername());
+      chkdtl.setCreatetime(systemUtilService.getSysdatetime().getHostdatetime());
+      chkdtl.setTenantId(shop.getTenantId());
+      operChkdtlDao.save(chkdtl); //审批记录
+      return 1;
+    }
+  }
+
+  @Override
+  public int updateShop(TShop shop, boolean needCheck, TOperator oper) throws WebCheckException {
+    if (null != shop) {
+      if (TradeDict.STATUS_CLOSED.equals(shop.getStatus())) {
+        throw new WebCheckException("商户已经被删除,请重新查询再操作");
+      }
+      if (shop.getFshopid() != 0) {
+        TShop fshop = shopDao.getTShopByShopid(shop.getFshopid());
+        if (null == fshop) {
+          throw new WebCheckException("上级商户不存在!");
+        } else if (!enumUtil.isInEnums(fshop.getShoptype(),
+            ShopTypes.ROOT, ShopTypes.GROUP)) {
+          throw new WebCheckException("上级商户不是商户组!");
+        }
+      }
+      if (shopDao.checkShopnameExist(shop.getShopname(), shop.getFshopid(), shop.getShopid() == null ? 0 : shop.getShopid()) > 0) {
+        throw new WebCheckException("商户名称在同级下已经存在!");
+      }
+
+      if (!needCheck) {
+        //无需审核
+        shopDao.save(shop);
+        if (!StringUtil.isEmpty(shop.getShopaccno())) {
+          shopaccDao.updateShopnameByShopaccno(shop.getShopname(), shop.getShopaccno()); //更新商户名
+        }
+        return 0;
+      } else {
+        //需要审核
+        if (TradeDict.STATUS_UNCHECK.equals(shop.getStatus())) {
+          //待审核的商户直接更新原记录
+          shopDao.save(shop);
+          if (!StringUtil.isEmpty(shop.getShopaccno())) {
+            shopaccDao.updateShopnameByShopaccno(shop.getShopname(), shop.getShopaccno()); //更新商户名
+          }
+          return 0;
+        } else if (TradeDict.STATUS_REJECT.equals(shop.getStatus())) {
+          //被驳回的商户
+          shop.setStatus(TradeDict.STATUS_UNCHECK); //重新变为待审核
+          shopDao.save(shop);
+          if (!StringUtil.isEmpty(shop.getShopaccno())) {
+            shopaccDao.updateShopnameByShopaccno(shop.getShopname(), shop.getShopaccno()); //更新商户名
+          }
+
+          TOperChkdtl chkdtl = new TOperChkdtl();
+          chkdtl.setChkType(ConstantUtil.OPERCHK_CHKTYPE_SHOP);
+          chkdtl.setChkMode(ConstantUtil.OPERCHK_CHKMODE_ADD);
+          chkdtl.setContentId(shop.getShopid().toString());
+          chkdtl.setChkResult(TradeDict.STATUS_UNCHECK);
+          chkdtl.setCreateOperid(oper.getOperid());
+          chkdtl.setCreateOpername(oper.getOpername());
+          chkdtl.setCreatetime(systemUtilService.getSysdatetime().getHostdatetime());
+          chkdtl.setTenantId(shop.getTenantId());
+          operChkdtlDao.save(chkdtl); //审批记录
+          return 1;
+        } else {
+          //正常的商户,新增审核记录
+          operChkdtlDao.doClearChkdtl(ConstantUtil.OPERCHK_CHKTYPE_SHOP, ConstantUtil.OPERCHK_CHKMODE_MODIFY, shop.getShopid().toString()); //未审核的修改记录作废
+          TOperChkdtl chkdtl = new TOperChkdtl();
+          chkdtl.setChkType(ConstantUtil.OPERCHK_CHKTYPE_SHOP);
+          chkdtl.setChkMode(ConstantUtil.OPERCHK_CHKMODE_MODIFY);
+          chkdtl.setContentId(shop.getShopid().toString());
+          chkdtl.setContent(new Gson().toJson(shop)); //修改后的商户信息json暂存
+          chkdtl.setChkResult(TradeDict.STATUS_UNCHECK);
+          chkdtl.setCreateOperid(oper.getOperid());
+          chkdtl.setCreateOpername(oper.getOpername());
+          chkdtl.setCreatetime(systemUtilService.getSysdatetime().getHostdatetime());
+          chkdtl.setTenantId(shop.getTenantId());
+          operChkdtlDao.save(chkdtl); //审批记录
+          return 1;
+        }
+      }
+    }
+    return -1;
+
+
   }
 
   @Override
@@ -234,7 +427,7 @@
       List<TSourceTypeConfig> list = sourceTypeConfigDao.getBySourceTypeOrderByConfigid(paytype.trim());
       if (!StringUtil.isEmpty(list)) {
         for (TSourceTypeConfig pt : list) {
-          if(pt.getGlobalflag()){
+          if (pt.getGlobalflag()) {
             continue; //通用参数跳过
           }
           TShopSourceTypeConfig spc = shopPaytypeConfigDao.getShopSourceTypeConfigById(shopaccno, pt.getSourceType(), pt.getConfigid());
@@ -296,7 +489,7 @@
       node.setField(StringUtil.isEmpty(shop.getShopaccno()) ? "" : shop.getShopaccno().trim());
       node.setSpread(true);
       List<LayerTreeNode> children = getShopLayerChildres(shoplist, shop.getShopid());
-      node.setChildren(StringUtil.isEmpty(children)? null : children);
+      node.setChildren(StringUtil.isEmpty(children) ? null : children);
       result.add(node); //跟节点
     }
     return result;
@@ -309,8 +502,6 @@
         LayerTreeNode node = new LayerTreeNode();
         node.setTitle(shop.getShopname());
         node.setId(shop.getShopid().toString());
-        node.setTitle(shop.getShopname());
-        node.setId(shop.getShopid().toString());
         node.setField(StringUtil.isEmpty(shop.getShopaccno()) ? "" : shop.getShopaccno().trim());
         node.setSpread(StringUtil.isEmpty(shop.getShopaccno()));
         List<LayerTreeNode> children = getShopLayerChildres(shoplist, shop.getShopid());
@@ -321,4 +512,347 @@
     return result;
   }
 
+  @Override
+  public List<LayerTreeNode> getShopManageLayerShopTree(String operid) {
+    if (StringUtil.isEmpty(operid)) return getLayerShopTree();
+
+    List<TShop> shoplist = shopDao.findAllShops();
+    List<TShop> rootlist = shopDao.getRootShops();
+    List<LayerTreeNode> result = new ArrayList<>(0);
+    if (StringUtil.isEmpty(rootlist)) {
+      return result;
+    }
+    for (TShop shop : rootlist) {
+      if (TradeDict.STATUS_CLOSED.equals(shop.getStatus())) continue; //注销商户跳过
+      if (!TradeDict.STATUS_NORMAL.equals(shop.getStatus()) && !operid.equals(shop.getAddOperid()))
+        continue;  //非正常商户,非用户权限跳过
+      LayerTreeNode node = new LayerTreeNode();
+      node.setTitle(shop.getShopname());
+      if (TradeDict.STATUS_UNCHECK.equals(shop.getStatus())) {
+        node.setTitle(shop.getShopname() + " (待审核)");
+      } else if (TradeDict.STATUS_REJECT.equals(shop.getStatus())) {
+        node.setTitle(shop.getShopname() + " (被驳回)");
+      }
+      node.setId(shop.getShopid().toString());
+      node.setField(StringUtil.isEmpty(shop.getShopaccno()) ? "" : shop.getShopaccno().trim());
+      node.setSpread(true);
+      List<LayerTreeNode> children = getShopManageLayerChildres(shoplist, shop.getShopid(), operid);
+      node.setChildren(StringUtil.isEmpty(children) ? null : children);
+      result.add(node); //跟节点
+    }
+    return result;
+  }
+
+  private List<LayerTreeNode> getShopManageLayerChildres(List<TShop> shoplist, Integer fshopid, String operid) {
+    List<LayerTreeNode> result = new ArrayList<>(0);
+    for (TShop shop : shoplist) {
+      if (TradeDict.STATUS_CLOSED.equals(shop.getStatus())) continue; //注销商户跳过
+      if (!TradeDict.STATUS_NORMAL.equals(shop.getStatus()) && !operid.equals(shop.getAddOperid()))
+        continue;  //非正常商户,非用户权限跳过
+      if (fshopid.equals(shop.getFshopid())) {
+        LayerTreeNode node = new LayerTreeNode();
+        node.setTitle(shop.getShopname());
+        if (TradeDict.STATUS_UNCHECK.equals(shop.getStatus())) {
+          node.setTitle(shop.getShopname() + " (待审核)");
+        } else if (TradeDict.STATUS_REJECT.equals(shop.getStatus())) {
+          node.setTitle(shop.getShopname() + " (被驳回)");
+        }
+        node.setId(shop.getShopid().toString());
+        node.setField(StringUtil.isEmpty(shop.getShopaccno()) ? "" : shop.getShopaccno().trim());
+        node.setSpread(!ShopTypes.NORMAL.toString().equals(shop.getShoptype()));
+        List<LayerTreeNode> children = getShopManageLayerChildres(shoplist, shop.getShopid(), operid);
+        node.setChildren(StringUtil.isEmpty(children) ? null : children);
+        result.add(node);
+      }
+    }
+    return result;
+  }
+
+  @Override
+  public PageResult<TShop> getShopListBySearch(String status, String shopname, Integer shopid, int pageNo, int pageSize) {
+    Pageable pageable = PageRequest.of(pageNo - 1, pageSize, Sort.by("shopid"));
+    Page<TShop> page = shopDao.findAll(new Specification<TShop>() {
+      @Override
+      public Predicate toPredicate(Root<TShop> root, CriteriaQuery<?> query, CriteriaBuilder criteriaBuilder) {
+        List<Predicate> predicates = new ArrayList<>();
+        if (!StringUtil.isEmpty(status)) {
+          predicates.add(criteriaBuilder.equal(root.get("status").as(String.class), status.trim()));
+        }
+        if (!StringUtil.isEmpty(shopname)) {
+          predicates.add(criteriaBuilder.like(root.get("shopname").as(String.class), "%" + shopname.trim() + "%"));
+        }
+        if (null != shopid) {
+          predicates.add(criteriaBuilder.equal(root.get("shopid").as(Integer.class), shopid));
+        }
+        predicates.add(criteriaBuilder.notEqual(root.get("status").as(String.class), TradeDict.STATUS_CLOSED)); //排除注销商户
+        return criteriaBuilder.and(predicates.toArray(new Predicate[0]));
+      }
+    }, pageable);
+
+    return new PageResult<>(page);
+  }
+
+  @Override
+  public List<TreeSelectNode> getChooseShopGroup() {
+    List<TShop> rootList = shopDao.getRootNormalShops();
+    List<TShop> shoplist = shopDao.findAllShops();
+    List<TreeSelectNode> result = new ArrayList<>(0);
+    if (StringUtil.isEmpty(rootList)) {
+      return result;
+    }
+    for (TShop rt : rootList) {
+      TreeSelectNode node = new TreeSelectNode();
+      node.setId(rt.getShopid().toString());
+      node.setName(rt.getShopname());
+      node.setOpen(true);
+      node.setChecked(false);
+      node.setAccno(rt.getShopaccno() == null ? "" : rt.getShopaccno());
+      node.setpId(String.valueOf(rt.getFshopid()));
+      List<TreeSelectNode> children = getChooseShopGroupTree(shoplist, rt.getShopid());
+      node.setChildren(StringUtil.isEmpty(children) ? null : children);
+      result.add(node);
+    }
+    return result;
+  }
+
+  private List<TreeSelectNode> getChooseShopGroupTree(List<TShop> shopList, int fshopid) {
+    List<TreeSelectNode> result = new ArrayList<>(0);
+    if (!StringUtil.isEmpty(shopList)) {
+      for (TShop shop : shopList) {
+        if (fshopid == shop.getFshopid() && !ShopTypes.NORMAL.toString().equals(shop.getShoptype()) && TradeDict.STATUS_NORMAL.equals(shop.getStatus())) {
+          //状态正常的商户组
+          TreeSelectNode node = new TreeSelectNode();
+          node.setId(shop.getShopid().toString());
+          node.setName(shop.getShopname());
+          node.setOpen(true);
+          node.setChecked(false);
+          node.setAccno(shop.getShopaccno() == null ? "" : shop.getShopaccno());
+          node.setpId(String.valueOf(fshopid));
+          List<TreeSelectNode> children = getChooseShopGroupTree(shopList, shop.getShopid());
+          node.setChildren(StringUtil.isEmpty(children) ? null : children);
+          result.add(node);
+        }
+      }
+    }
+    return result;
+  }
+
+  @Override
+  public PageResult<TOperChkdtl> getShopChkdtlDetails(String shopid, String status, String searchkey, int pageNo, int pageSize) {
+    Pageable pageable = PageRequest.of(pageNo - 1, pageSize, Sort.by(Sort.Direction.DESC,"chkNo"));
+
+    Page<TOperChkdtl> page = operChkdtlDao.findAll(new Specification<TOperChkdtl>() {
+      @Override
+      public Predicate toPredicate(Root<TOperChkdtl> root, CriteriaQuery<?> query, CriteriaBuilder criteriaBuilder) {
+        List<Predicate> predicates = new ArrayList<>();
+        if (!StringUtil.isEmpty(shopid)) {
+          predicates.add(criteriaBuilder.equal(root.get("contentId").as(String.class), shopid.trim()));
+        }
+        if (!StringUtil.isEmpty(status)) {
+          predicates.add(criteriaBuilder.equal(root.get("chkResult").as(String.class), status.trim()));
+        }
+        if (!StringUtil.isEmpty(searchkey)) {
+          predicates.add(criteriaBuilder.or(criteriaBuilder.like(root.get("chkNo").as(String.class), "%" + searchkey.trim() + "%"),
+              criteriaBuilder.like(root.get("createOpername").as(String.class), "%" + searchkey.trim() + "%"),
+              criteriaBuilder.like(root.get("checkOpername").as(String.class), "%" + searchkey.trim() + "%")));
+        }
+        predicates.add(criteriaBuilder.equal(root.get("chkType").as(String.class), ConstantUtil.OPERCHK_CHKTYPE_SHOP));
+        predicates.add(criteriaBuilder.equal(root.get("invalidflag").as(Boolean.class), false));
+        return criteriaBuilder.and(predicates.toArray(new Predicate[0]));
+      }
+    }, pageable);
+    return new PageResult<>(page);
+  }
+
+  @Override
+  public TOperChkdtl getOperChkdtlByChkno(Long chkno) {
+    TOperChkdtl chkdtl = operChkdtlDao.getByChkno(chkno != null ? chkno : -99L);
+    if (null != chkdtl) {
+      return chkdtl;
+    }
+    return new TOperChkdtl();
+  }
+
+  private boolean checkSameString(String str1, String str2) {
+    if (StringUtil.isEmpty(str1) && StringUtil.isEmpty(str2)) return true;
+    if (null != str1 && str1.equals(str2)) return true;
+    return false;
+  }
+
+  @Override
+  public ShopCheckBean getOperChkShopInfo(TOperChkdtl chkdtl) {
+    if (null == chkdtl || null == chkdtl.getChkNo() || !ConstantUtil.OPERCHK_CHKTYPE_SHOP.equals(chkdtl.getChkType()))
+      return new ShopCheckBean();
+    TShop tShop = shopDao.getTShopByShopid(Integer.valueOf(chkdtl.getContentId()));
+    if (null == tShop) return new ShopCheckBean(); //未找到商户
+    ShopCheckBean result = new ShopCheckBean();
+    if (ConstantUtil.OPERCHK_CHKMODE_MODIFY.equals(chkdtl.getChkMode())) {
+      TShop shop = new Gson().fromJson(chkdtl.getContent(), TShop.class); //修改后的商户记录
+      BeanUtils.copyProperties(shop, result);
+      //判断哪些字段有修改
+      if (result.getFshopid() != tShop.getFshopid().intValue()) result.setOldFshopid(tShop.getFshopid());
+      if (!result.getShopname().equals(tShop.getShopname())) result.setOldShopname(tShop.getShopname());
+      if (!checkSameString(result.getBusinessLicenseNo(), tShop.getBusinessLicenseNo()))
+        result.setOldBusinessLicenseNo(tShop.getBusinessLicenseNo());
+      if (!checkSameString(result.getTaxRegistrationNo(), tShop.getTaxRegistrationNo()))
+        result.setOldTaxRegistrationNo(tShop.getTaxRegistrationNo());
+      if (!checkSameString(result.getLegalPersonName(), tShop.getLegalPersonName()))
+        result.setOldLegalPersonName(tShop.getLegalPersonName());
+      if (!checkSameString(result.getLegalPersonIdtype(), tShop.getLegalPersonIdtype()))
+        result.setOldLegalPersonIdtype(tShop.getLegalPersonIdtype());
+      if (!checkSameString(result.getLegalPersonIdno(), tShop.getLegalPersonIdno()))
+        result.setOldLegalPersonIdno(tShop.getLegalPersonIdno());
+      if (!checkSameString(result.getContactman(), tShop.getContactman()))
+        result.setOldContactman(tShop.getContactman());
+      if (!checkSameString(result.getMobile(), tShop.getMobile())) result.setOldMobile(tShop.getMobile());
+      if (!checkSameString(result.getEmail(), tShop.getEmail())) result.setOldEmail(tShop.getEmail());
+      if (!checkSameString(result.getTel(), tShop.getTel())) result.setOldTel(tShop.getTel());
+    } else {
+      BeanUtils.copyProperties(tShop, result);
+    }
+
+    if (null != result.getFshopid() && result.getFshopid() > 0) {
+      TShop fshop = shopDao.getTShopByShopid(result.getFshopid());
+      result.setFshopname(fshop == null ? "" : fshop.getShopname());
+    }
+    if (null != result.getOldFshopid() && result.getOldFshopid() > 0) {
+      TShop fshop = shopDao.getTShopByShopid(result.getOldFshopid());
+      result.setFshopname(fshop == null ? "" : fshop.getShopname());
+    }
+    if (null != result.getLegalPersonIdtype()) {
+      TDictionary dict = dictionaryDao.getByDicttypeAndDictval(Dictionary.IDTYPE, result.getLegalPersonIdtype());
+      result.setLegalPersonIdtype(dict == null ? "其他" : dict.getDictcaption());
+    }
+    if (null != result.getOldLegalPersonIdtype()) {
+      TDictionary dict = dictionaryDao.getByDicttypeAndDictval(Dictionary.IDTYPE, result.getOldLegalPersonIdtype());
+      result.setOldLegalPersonIdtype(dict == null ? "其他" : dict.getDictcaption());
+    }
+    return result;
+  }
+
+  @Override
+  public TOperChkdtl doCheckShopChkdtl(Long chkno, boolean passflag, String chkmsg, TOperator oper) throws Exception {
+    TOperChkdtl chkdtl = operChkdtlDao.getByChknoForUpdate(chkno);
+    if (null == chkdtl) {
+      throw new WebCheckException("审批记录不存在!");
+    } else if (!TradeDict.STATUS_UNCHECK.equals(chkdtl.getChkResult())) {
+      throw new WebCheckException("审批记录已被审核,请重新查询再操作!");
+    } else if (!ConstantUtil.OPERCHK_CHKTYPE_SHOP.equals(chkdtl.getChkType())) {
+      throw new WebCheckException("该记录非商户审批记录,请重新查询再操作!");
+    } else if (chkdtl.getInvalidflag()) {
+      throw new WebCheckException("该审批记录已作废,请重新查询再操作!");
+    }
+
+    TShop shop = shopDao.getTShopByShopid(Integer.valueOf(chkdtl.getContentId()));
+    if (null == shop) {
+      throw new WebCheckException("业务异常!审批记录指定的商户已被删除!");
+    }
+    if (null != oper) {
+      chkdtl.setCheckOperid(oper.getOperid());
+      chkdtl.setCheckOpername(oper.getOpername());
+    }
+    chkdtl.setChkMsg(StringUtil.isEmpty(chkmsg) ? null : chkmsg.trim());
+    chkdtl.setChecktime(systemUtilService.getSysdatetime().getHostdatetime());
+
+    if (passflag) {
+      //审核通过
+      if (ConstantUtil.OPERCHK_CHKMODE_DELETE.equals(chkdtl.getChkMode())) {
+        //同意删除申请
+        if (ShopTypes.ROOT.value().equals(shop.getShoptype())) {
+          chkdtl.setChkResult(TradeDict.STATUS_REJECT); //拒绝
+          chkdtl.setChkMsg("不能删除根商户节点");
+        } else {
+          if (!TradeDict.STATUS_CLOSED.equals(shop.getStatus())) {
+            List<TShop> childShops = shopDao.getChildShopsByShopid(shop.getShopid());
+            if (!StringUtil.isEmpty(childShops)) {
+              chkdtl.setChkResult(TradeDict.STATUS_REJECT); //拒绝
+              chkdtl.setChkMsg("该商户下存在正常的下级商户,不满足删除条件!");
+            } else {
+              //可以删除
+              chkdtl.setChkResult(TradeDict.STATUS_NORMAL); //通过
+
+              shop.setStatus(TradeDict.STATUS_CLOSED);
+              shop.setClosedate(systemUtilService.getSysdatetime().getHostdate());
+              shop.setDelOperid(chkdtl.getCreateOperid());
+              shopDao.save(shop);
+              if (!StringUtil.isEmpty(shop.getShopaccno())) {
+                TShopacc shopacc = shopaccDao.getByShopaccno(shop.getShopaccno());
+                if (null == shopacc) throw new WebCheckException("数据异常!对应的商户账户不存在!");
+                shopacc.setStatus(TradeDict.STATUS_CLOSED);
+                shopacc.setClosedate(shop.getClosedate());
+                shopaccDao.save(shopacc);
+              }
+            }
+          }
+        }
+
+      } else if (ConstantUtil.OPERCHK_CHKMODE_ADD.equals(chkdtl.getChkMode())) {
+        //同意新增
+        chkdtl.setChkResult(TradeDict.STATUS_NORMAL); //通过
+
+        shop.setStatus(TradeDict.STATUS_NORMAL); //状态置为正常
+        shop.setAddOperid(chkdtl.getCreateOperid());
+        shop.setShopaccno(null);
+        if (ShopTypes.NORMAL.toString().equals(shop.getShoptype())) {
+          String shopaccno = String.format("2%09d", shop.getShopid());
+          TShopacc shopacc = shopaccDao.getByShopaccno(shopaccno);
+          if (null != shopacc) {
+            shopacc.setStatus(shop.getStatus());
+            shopacc.setShopname(shop.getShopname());
+            shopaccDao.save(shopacc);
+          } else {
+            shopacc = new TShopacc();
+            shopacc.setShopaccno(shopaccno);
+            shopacc.setShopid(shop.getShopid());
+            shopacc.setShopname(shop.getShopname());
+            shopacc.setSubjno(Subject.SUBJNO_MACHANT_INCOME);
+            shopacc.setStatus(shop.getStatus());
+            shopacc.setOpendate(systemUtilService.getSysdatetime().getHostdate());
+            shopacc.setBalance(0D);
+            shopacc.setTenantId(shop.getTenantId());
+            shopacc = shopaccDao.save(shopacc);
+            shopacc.setMac(shopacc.genMAC());
+            shopaccDao.save(shopacc);
+          }
+          shop.setShopaccno(shopacc.getShopaccno());
+        }
+        shopDao.save(shop);
+
+      } else if (ConstantUtil.OPERCHK_CHKMODE_MODIFY.equals(chkdtl.getChkMode())) {
+        //同意修改
+        chkdtl.setChkResult(TradeDict.STATUS_NORMAL); //通过
+
+        TShop newShop = new Gson().fromJson(chkdtl.getContent(), TShop.class);
+        shop.setFshopid(newShop.getFshopid());
+        shop.setShopname(newShop.getShopname());
+        shop.setBusinessLicenseNo(newShop.getBusinessLicenseNo());
+        shop.setTaxRegistrationNo(newShop.getTaxRegistrationNo());
+        shop.setAddr(newShop.getAddr());
+        shop.setLegalPersonName(newShop.getLegalPersonName());
+        shop.setLegalPersonIdtype(newShop.getLegalPersonIdtype());
+        shop.setLegalPersonIdno(newShop.getLegalPersonIdno());
+        shop.setContactman(newShop.getContactman());
+        shop.setMobile(newShop.getMobile());
+        shop.setEmail(newShop.getEmail());
+        shop.setTel(newShop.getTel());
+        shopDao.save(shop);
+        if (!StringUtil.isEmpty(shop.getShopaccno())) {
+          shopaccDao.updateShopnameByShopaccno(shop.getShopname(), shop.getShopaccno()); //更新商户名
+        }
+      } else {
+        //非增删改
+        throw new WebCheckException("该审批记录数据错误,非新增、修改、删除操作!");
+      }
+    } else {
+      //审核驳回
+      chkdtl.setChkResult(TradeDict.STATUS_REJECT);
+      if (TradeDict.STATUS_UNCHECK.equals(shop.getStatus())) {
+        //新增时改变状态,其他的不变
+        shop.setStatus(TradeDict.STATUS_REJECT);
+        shopDao.save(shop);
+      }
+    }
+    return operChkdtlDao.save(chkdtl);
+  }
+
 }
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 6862e9d..873e619 100644
--- a/payapi/src/main/java/com/supwisdom/dlpay/util/ConstantUtil.java
+++ b/payapi/src/main/java/com/supwisdom/dlpay/util/ConstantUtil.java
@@ -81,4 +81,12 @@
 
   public static final String CITIZENCARD_SYSTEM_URL = "dlsmk.cardsystem.url"; //大理市民卡管系统url
 
+  /**
+   * 商户审批
+   * */
+  public static final String OPERCHK_CHKTYPE_SHOP = "SHOP";
+
+  public static final String OPERCHK_CHKMODE_ADD = "新增";
+  public static final String OPERCHK_CHKMODE_MODIFY = "修改";
+  public static final String OPERCHK_CHKMODE_DELETE = "删除";
 }
diff --git a/payapi/src/main/resources/data.sql b/payapi/src/main/resources/data.sql
index d218c43..32cfd2f 100644
--- a/payapi/src/main/resources/data.sql
+++ b/payapi/src/main/resources/data.sql
@@ -50,7 +50,7 @@
 INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
 VALUES (22, NULL, 1, NULL, '', '/user/acc', '账户管理', 2, 19, '{tenantid}');
 INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
-VALUES (25, NULL, 1, NULL, '', '/shop/config', '商户支付能力配置', 2, 7, '{tenantid}');
+VALUES (25, NULL, 1, NULL, '', '/shop/config', '商户支付能力配置', 3, 7, '{tenantid}');
 INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
 VALUES (26, NULL, 0, NULL, 'layui-icon-tabs', '#', '流水管理', 3, -1, '{tenantid}');
 INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
@@ -71,8 +71,8 @@
 VALUES (34, NULL, 1, NULL, '', '/thirdchk/chkstatus', '对账状态查询', 331, 33, '{tenantid}');
 INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
 VALUES (35, NULL, 1, NULL, '', '/thirdchk/chkfile', '对账明细查询', 332, 33, '{tenantid}');
-
-
+INSERT INTO "tb_function" ("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid", tenantid)
+VALUES (36, NULL, 1, NULL, '', '/shop/shopcheck', '商户审批', 2, 7, '{tenantid}');
 
 INSERT INTO "tb_role_function" ("id", "functionid", "roleid", tenantid)
 VALUES ('ff8080816b7947ed016b7955772c0032', 1, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
@@ -134,6 +134,9 @@
 VALUES ('ff8082816c8468e8016c846d7a570017', 34, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
 INSERT INTO "tb_role_function" ("id", "functionid", "roleid", tenantid)
 VALUES ('ff8083816c8468e8016c846d7a570017', 35, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO "tb_role_function" ("id", "functionid", "roleid", tenantid)
+VALUES ('ff8080816db87e27016db88be41a0014', 36, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+
 
 INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
 VALUES (4, '1', 4, '添加功能', '/function/add', '{tenantid}');
@@ -224,11 +227,11 @@
 INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
 VALUES (54, '', 21, '添加', '/user/add', '{tenantid}');
 INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (56, '', 23, '查询', '/shop/getshopinfo', '{tenantid}');
+VALUES (56, '', 23, '商户详情', '/shop/getshopinfo', '{tenantid}');
 INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (57, '', 23, '商户树', '/shop/index', '{tenantid}');
+VALUES (57, '', 23, '查询', '/shop/index', '{tenantid}');
 INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
-VALUES (58, '', 23, '新增修改', '/shop/saveorupdate', '{tenantid}');
+VALUES (58, '', 23, '新增跳转', '/shop/load4addshop', '{tenantid}');
 INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
 VALUES (59, '', 21, '删除', '/user/del', '{tenantid}');
 INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
@@ -273,6 +276,20 @@
 VALUES (81, '', 35, '查询', '/thirdchk/chkfile', '{tenantid}');
 INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
 VALUES (82, '', 35, '查看详情', '/thirdchk/chkdtl', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (83, '', 23, '新增商户', '/shop/addshop', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (84, '', 23, '修改跳转', '/shop/load4updateshop', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (85, '', 23, '修改', '/shop/updateshop', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (86, '', 23, '审批意见', '/shop/getshopchk', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (87, '', 36, '查询', '/shop/shopcheck', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (88, '', 36, '审核跳转', '/shop/opercheck', '{tenantid}');
+INSERT INTO "tb_resource" ("id", "code", "function_id", "name", "uri", tenantid)
+VALUES (89, '', 36, '审核', '/shop/docheckshop', '{tenantid}');
 
 
 INSERT INTO "tb_permission" ("id", "resid", "role_func_id", "roleid", tenantid)
@@ -413,6 +430,20 @@
 VALUES ('ff8080816c985e76016c98659ad10017', 81, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
 INSERT INTO  "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
 VALUES ('ff8080816c99abee016c99b1cb1c0004', 82, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO  "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('402868516daf75de016dafb36670002a', 83, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO  "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816db54261016db543aad40009', 84, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO  "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('402868516daf15d2016daf1fcb290017', 85, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO  "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816db36bbd016db36ff8580010', 86, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO  "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816db36bbd016db36ff8580011', 87, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO  "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816db87e27016db94468da0089', 88, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
+INSERT INTO  "tb_permission" ("id", "resid", "role_func_id", "roleid", "tenantid")
+VALUES ('ff8080816db87e27016db94468da008a', 89, NULL, 'd1yctWs5+ks0iQN3m9bUvRHus6HbKbrs', '{tenantid}');
 
 
 INSERT INTO "tb_subject" ("subjid","subjno", "balflag", "displayflag", "endflag", "fsubjno", "opendate", "subjlevel", "subjname", "subjtype", "tenantid")
@@ -547,6 +578,8 @@
 VALUES (3, 'yes', 1, '20190514165658', '默认日累计额度', '元', '200.0', '账户余额支付时默认的日累计额度', 'amount', '{tenantid}');
 INSERT INTO "tb_syspara" ("paraid", "displayflag", "editflag", "lastsaved", "paraname", "paraunit", "paraval", "remark", "valuetype", "tenantid")
 VALUES (4, 'yes', 1, '20190514165658', '手机端用户过期时间', '秒', null, '手机端用户过期时间(秒)', 'decimal', '{tenantid}');
+INSERT INTO "tb_syspara" ("paraid", "displayflag", "editflag", "lastsaved", "paraname", "paraunit", "paraval", "remark", "valuetype", "tenantid")
+VALUES (5, 'yes', 1, '20190514165658', '商户信息维护是否需要审核', '', '0', '商户的新增、修改、删除是否需要审核:1-需要;0-不需要', 'switch', '{tenantid}');
 
 INSERT INTO "tb_syspara" ("paraid", "displayflag", "editflag", "lastsaved", "paraname", "paraunit", "paraval", "remark", "valuetype", "tenantid")
 VALUES (2019, 'yes', 1, '20190514165658', '与卡管系统对接的应用ID', null, null, '与卡管系统对接的app_id', 'string', '{tenantid}');
@@ -559,8 +592,8 @@
 INSERT INTO "tb_task_lock" ("taskcode", "remark", "taskstatus", "tasktime", "tenantid")
 VALUES ('DAYENDSETTLETASK', '日终结算', '0', '20190619100600', '{tenantid}');
 
-INSERT INTO "tb_shop" ("shopid", "shopname", "shoptype", "fshopid", "status", "opendate", "tenantid")
-VALUES (1, '支付中心', 'root', 0, 'normal', '20190517', '{tenantid}');
+INSERT INTO "tb_shop" ("shopid", "shopname", "shoptype", "fshopid", "status", "check_status", "opendate", "tenantid")
+VALUES (1, '支付中心', 'root', 0, 'normal', 'normal', '20190517', '{tenantid}');
 
 INSERT INTO "tb_transcode" ("transcode_id", "transcode", "transname", "tenantid")
 VALUES (1, 3010, '市民卡代扣', '{tenantid}');
diff --git a/payapi/src/main/resources/static/custom/module/admin.js b/payapi/src/main/resources/static/custom/module/admin.js
index 1694286..e557e6c 100755
--- a/payapi/src/main/resources/static/custom/module/admin.js
+++ b/payapi/src/main/resources/static/custom/module/admin.js
@@ -224,7 +224,7 @@
         },

         formatDate:function (str) {

             if (str == null || str == "") {

-                return;

+                return '';

             }

             switch (str.length) {

                 case 8:

diff --git a/payapi/src/main/resources/static/libs/custom.js b/payapi/src/main/resources/static/libs/custom.js
index c2b560a..d034401 100644
--- a/payapi/src/main/resources/static/libs/custom.js
+++ b/payapi/src/main/resources/static/libs/custom.js
@@ -102,4 +102,10 @@
     root.dateFormat = function (str) {
         return str.replace(/^(\d{4})(\d{2})(\d{2})$/, '$1-$2-$3'); //yyyyMMdd --> yyyy-MM-dd
     }
+
+    root.isempty = function (s) {
+        if (s == null || s.length == 0)
+            return true;
+        return /\s/.test(s);
+    }
 }(window));
\ No newline at end of file
diff --git a/payapi/src/main/resources/templates/system/shop/addshop.html b/payapi/src/main/resources/templates/system/shop/addshop.html
new file mode 100644
index 0000000..1a1bd62
--- /dev/null
+++ b/payapi/src/main/resources/templates/system/shop/addshop.html
@@ -0,0 +1,329 @@
+<div class="layui-card">
+    <div class="layui-card-header">
+        <h2 class="header-title">新增商户</h2>
+        <span class="layui-breadcrumb pull-right">
+          <a href="#!_shop_index">商户管理</a>
+          <a><cite>新增商户</cite></a>
+        </span>
+    </div>
+    <div class="layui-card-body">
+        <div id="shop-add-info" class="layui-form toolbar" lay-filter="shop-add-info-form">
+            <div class="layui-card-header">商户基本信息</div>
+            <div class="layui-form-item" style="margin-left: 15px;margin-top: 15px;">
+                <label class="layui-form-label" style="color: red;width: 100px;"><span
+                        style="color: red;">*</span>商户类型</label>
+                <div class="layui-input-inline">
+                    <select name="shoptype" id="shop-add-shoptype" lay-filter="shop-add-shoptype-filter"
+                            lay-verify="required">
+                        <option value="group">商户组</option>
+                        <option value="normal">结算商户</option>
+                    </select>
+                </div>
+                <div class="layui-form-mid layui-word-aux">
+                    注意:商户组无商户账号,且能创建下级商户。结算商户是叶子商户,会创建商户账号。保存后无法修改!!!
+                </div>
+            </div>
+            <div class="layui-card-body">
+                <div class="layui-form-item">
+                    <div class="layui-inline">
+                        <label class="layui-form-label" style="width: 100px;">商户号</label>
+                        <div class="layui-input-inline">
+                            <input type="text" name="shopid" class="layui-input" style="background-color: #f1f1f1;"
+                                   value="0"
+                                   readonly="readonly"/>
+                        </div>
+                    </div>
+                    <div class="layui-inline">
+                        <label class="layui-form-label" style="width: 100px;">商户账号</label>
+                        <div class="layui-input-inline">
+                            <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" style="width: 100px;"><span
+                                style="color: red;">*</span>上级商户号</label>
+                        <div class="layui-input-inline">
+                            <input type="text" name="fshopid" id="shop-add-fshopid" class="layui-input"
+                                   autocomplete="off" placeholder="请选择"
+                                   lay-verify="required|number"/>
+                        </div>
+                    </div>
+                    <div class="layui-inline">
+                        <label class="layui-form-label" style="width: 100px;"><span
+                                style="color: red;">*</span>商户名</label>
+                        <div class="layui-input-inline">
+                            <input type="text" name="shopname" id="shop-add-shopname" autocomplete="off"
+                                   class="layui-input" maxlength="30" lay-verify="required"/>
+                        </div>
+                    </div>
+                </div>
+            </div>
+            <div class="layui-card-header">商户营业信息</div>
+            <div class="layui-card-body">
+                <div class="layui-form-item" style="margin-left: 15px;margin-top: 15px;">
+                    <label class="layui-form-label" style="width: 90px;"><span
+                            style="color: red;">*</span>营业执照编号</label>
+                    <div class="layui-input-inline" style="width: 525px;">
+                        <input name="businessLicenseNo" id="shop-add-businessLicenseNo" class="layui-input"
+                               autocomplete="off"/>
+                    </div>
+                </div>
+
+                <div class="layui-form-item" style="margin-left: 15px;">
+                    <label class="layui-form-label" style="width: 90px;"><span
+                            style="color: red;">*</span>税务登记证号</label>
+                    <div class="layui-input-inline" style="width: 525px;">
+                        <input name="taxRegistrationNo" id="shop-add-taxRegistrationNo" class="layui-input"
+                               autocomplete="off"/>
+                    </div>
+                </div>
+
+                <div class="layui-form-item" style="margin-left: 15px;">
+                    <label class="layui-form-label" style="width: 90px;"><span
+                            style="color: red;">*</span>商户经营地址</label>
+                    <div class="layui-input-inline" style="width: 525px;">
+                        <input name="addr" id="shop-add-addr" class="layui-input" autocomplete="off"/>
+                    </div>
+                </div>
+
+                <div class="layui-form-item" style="margin-left: 15px;">
+                    <label class="layui-form-label" style="width: 90px;"><span style="color: red;">*</span>法人姓名</label>
+                    <div class="layui-input-inline" style="width: 525px;">
+                        <input name="legalPersonName" id="shop-add-legalPersonName" class="layui-input"
+                               autocomplete="off"/>
+                    </div>
+                </div>
+
+                <div class="layui-form-item" style="margin-left: 15px;">
+                    <div class="layui-inline">
+                        <label class="layui-form-label" style="width: 90px;"><span
+                                style="color: red;">*</span>法人证件类型</label>
+                        <div class="layui-input-inline">
+                            <select name="legalPersonIdtype" id="shop-add-legalPersonIdtype" lay-filter="shop-add-legalPersonIdtype-filter" class="layui-select">
+                                <option th:each="bean : ${idtypeList}" th:value="${bean.dictval}">[[${bean.dictcaption}]]</option>
+                            </select>
+                        </div>
+                    </div>
+                    <div class="layui-inline">
+                        <label class="layui-form-label" style="width: 90px;"><span
+                                style="color: red;">*</span>法人证件号</label>
+                        <div class="layui-input-inline">
+                            <input type="text" name="legalPersonIdno" id="shop-add-legalPersonIdno" class="layui-input"
+                                   maxlength="20"
+                                   autocomplete="off"/>
+                        </div>
+                    </div>
+                </div>
+            </div>
+            <div class="layui-card-header">商户联系人信息</div>
+            <div class="layui-card-body">
+                <div class="layui-form-item">
+                    <div class="layui-inline">
+                        <label class="layui-form-label" style="width: 100px;">姓名</label>
+                        <div class="layui-input-inline">
+                            <input type="text" name="contactman" id="shop-add-contactman" class="layui-input"
+                                   autocomplete="off"/>
+                        </div>
+                    </div>
+                    <div class="layui-inline">
+                        <label class="layui-form-label" style="width: 100px;">手机号</label>
+                        <div class="layui-input-inline">
+                            <input type="text" name="mobile" id="shop-add-mobile" class="layui-input" maxlength="20"
+                                   autocomplete="off"
+                                   lay-verify="mobile"/>
+                        </div>
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <div class="layui-inline">
+                        <label class="layui-form-label" style="width: 100px;">邮箱</label>
+                        <div class="layui-input-inline">
+                            <input type="text" name="email" class="layui-input" autocomplete="off" id="shop-add-email"
+                                   lay-verify="swEmail"/>
+                        </div>
+                    </div>
+                    <div class="layui-inline">
+                        <label class="layui-form-label" style="width: 100px;">电话</label>
+                        <div class="layui-input-inline">
+                            <input type="text" name="tel" id="shop-add-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-add-btn-filter" lay-submit
+                        id="submitbtn-shop-add-btn">保存
+                </button>
+                <button class="layui-btn layui-btn-primary" type="button" id="submitbtn-shop-return-btn">返回
+                </button>
+                <div class="layui-inline" style="margin-left: 10px;">
+                    <input type="checkbox" id="shop-add-continue-flag" lay-skin="primary"
+                           title="继续新增"/>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+
+<script>
+    layui.use(['form', 'table', 'admin', 'jquery', 'element', 'treeSelect'], function () {
+        var form = layui.form;
+        var admin = layui.admin;
+        var $ = layui.jquery;
+        var element = layui.element;
+        var treeSelect = layui.treeSelect;
+
+        $("#shop-add-legalPersonIdtype").val("idcard");
+        form.render("select");
+        form.render("checkbox");
+        form.verify({
+            "mobile": function (e) {
+                if (null != e && e.length > 0 && !(/^1\d{10}$/.test(e))) {
+                    return "请输入正确的手机号";
+                }
+            },
+            "swEmail": function (e) {
+                if (null != e && e.length > 0 && !(/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(e))) {
+                    return "邮箱格式不正确";
+                }
+            }
+        });
+
+        treeSelect.render({
+            elem: '#shop-add-fshopid',
+            data: '[[@{/shop/selectshopgroup}]]',
+            type: 'get',
+            placeholder: '请选择',
+            search: false,
+            style: {
+                folder: {
+                    enable: false
+                },
+                line: {
+                    enable: true
+                }
+            },
+            // 点击回调
+            click: function (d) {
+                var treeNode = d.current;
+                return true;
+            },
+            success: function (d) {
+                console.log(d); // 加载完成后的回调函数
+            }
+        });
+
+        $("#submitbtn-shop-return-btn").click(function(){
+            element.tabDelete('admin-pagetabs', '_shop_manager_add'); //关闭现有详情
+            element.tabChange('admin-pagetabs','_shop_index');
+            admin.refresh();
+        });
+
+        $("#submitbtn-shop-add-btn").click(function () {
+            var shoptype = $("#shop-add-shoptype").val();
+            var fshopid = $("#shop-add-fshopid").val();
+            var shopname = $("#shop-add-shopname").val();
+            var businessLicenseNo = $("#shop-add-businessLicenseNo").val();
+            var taxRegistrationNo = $("#shop-add-taxRegistrationNo").val();
+            var addr = $("#shop-add-addr").val();
+            var legalPersonName = $("#shop-add-legalPersonName").val();
+            var legalPersonIdtype = $("#shop-add-legalPersonIdtype").val();
+            var legalPersonIdno = $("#shop-add-legalPersonIdno").val();
+            var contactman = $("#shop-add-contactman").val();
+            var mobile = $("#shop-add-mobile").val();
+            var email = $("#shop-add-email").val();
+            var tel = $("#shop-add-tel").val();
+            var token = $("meta[name='_csrf_token']").attr("value");
+            if (isempty(shoptype)) {
+                layer.msg("请选择商户类型", {icon: 2, time: 1000});
+                $("#shop-add-shoptype").focus();
+                return;
+            }
+            if (isempty(fshopid)) {
+                layer.msg("请选择上级商户", {icon: 2, time: 1000});
+                $("#shop-add-fshopid").focus();
+                return;
+            }
+            if (isempty(shopname)) {
+                layer.msg("请填写商户名称", {icon: 2, time: 1000});
+                $("#shop-add-shopname").focus();
+                return;
+            }
+            if ("normal" == shoptype) {
+                if (isempty(businessLicenseNo)) {
+                    layer.msg("请填写商户营业执照编号", {icon: 2, time: 1000});
+                    $("#shop-add-businessLicenseNo").focus();
+                    return;
+                }
+                if (isempty(taxRegistrationNo)) {
+                    layer.msg("请填写商户税务登记证号", {icon: 2, time: 1000});
+                    $("#shop-add-taxRegistrationNo").focus();
+                    return;
+                }
+                if (isempty(addr)) {
+                    layer.msg("请填写商户经营地址", {icon: 2, time: 1000});
+                    $("#shop-add-addr").focus();
+                    return;
+                }
+                if (isempty(legalPersonName)) {
+                    layer.msg("请填写商户法人姓名", {icon: 2, time: 1000});
+                    $("#shop-add-legalPersonName").focus();
+                    return;
+                }
+                if (isempty(legalPersonIdtype)) {
+                    layer.msg("请选择法人证件类型", {icon: 2, time: 1000});
+                    $("#shop-add-legalPersonIdtype").focus();
+                    return;
+                }
+                if (isempty(legalPersonIdno)) {
+                    layer.msg("请填写法人证件号", {icon: 2, time: 1000});
+                    $("#shop-add-legalPersonIdno").focus();
+                    return;
+                }
+            }
+
+            var str = $("#shop-add-shoptype").find("option:selected").text();
+            layer.confirm("确定要新增【" + str + " - " + shopname + " 】吗?", function () {
+                admin.go('[[@{/shop/addshop}]]', {
+                    shoptype: shoptype,
+                    fshopid: fshopid,
+                    shopname: shopname,
+                    businessLicenseNo: businessLicenseNo,
+                    taxRegistrationNo: taxRegistrationNo,
+                    addr: addr,
+                    legalPersonName: legalPersonName,
+                    legalPersonIdtype: legalPersonIdtype,
+                    legalPersonIdno: legalPersonIdno,
+                    contactman: contactman,
+                    mobile: mobile,
+                    email: email,
+                    tel: tel,
+                    _csrf: token
+                }, function (data) {
+                    if (data.code === 200) {
+                        layer.msg(data.msg, {icon: 1, time: 1000});
+                        if (!$("#shop-add-continue-flag").is(":checked")) {
+                            element.tabDelete('admin-pagetabs', '_shop_manager_add'); //关闭现有详情
+                            element.tabChange('admin-pagetabs','_shop_index');
+                            admin.refresh();
+                        }
+                    } else if (data.code === 401) {
+                        layer.msg(data.msg, {icon: 2, time: 1500}, function () {
+                            location.replace('[[@{/login}]]');
+                        }, 1000);
+                    } else {
+                        layer.msg(data.msg, {icon: 2});
+                        return;
+                    }
+                }, function (err) {
+                    admin.errorBack(err);
+                });
+            });
+        });
+    });
+</script>
\ No newline at end of file
diff --git a/payapi/src/main/resources/templates/system/shop/index.html b/payapi/src/main/resources/templates/system/shop/index.html
index 78ef8af..61e7cc7 100644
--- a/payapi/src/main/resources/templates/system/shop/index.html
+++ b/payapi/src/main/resources/templates/system/shop/index.html
@@ -13,153 +13,38 @@
                     <div class="layui-card-header">
                         商户树<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>
+                    <div class="layui-card-body layui-show"
+                         style="border: 1px solid #ddd;padding: 10px;min-height: 520px;overflow: auto;margin-top: 16px;"
+                         id="shop-manager-ztree">
                     </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 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>
-                            <div class="layui-input-inline">
-                                <select name="shoptype" id="shoptype" lay-filter="shoptype-filter"
-                                        lay-verify="required">
-                                    <option value="root">根商户</option>
-                                    <option value="group">商户组</option>
-                                    <option value="normal">结算商户</option>
-                                </select>
-                            </div>
-                            <div class="layui-form-mid layui-word-aux">
-                                注意:商户组无商户账号,且能创建下级商户。结算商户是叶子商户,会创建商户账号。保存后无法修改!!!
-                            </div>
-                        </div>
-                        <div class="layui-card-body">
-                            <div class="layui-form-item">
-                                <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;"
-                                               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;"
-                                               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>
-                                    <div class="layui-input-inline">
-                                        <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>
-                                    <div class="layui-input-inline">
-                                        <input type="text" name="shopname" autocomplete="off"
-                                               class="layui-input" maxlength="30" lay-verify="required"/>
-                                    </div>
-                                </div>
-                            </div>
-
-                            <div class="layui-form-item">
-                                <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"/>
-                                    </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"/>
-                                    </div>
-                                </div>
-                            </div>
-                        </div>
-                        <div class="layui-card-header">商户联系人信息</div>
-                        <div class="layui-card-body">
-                            <div class="layui-form-item">
-                                <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"/>
-                                    </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"/>
-                                    </div>
-                                </div>
-                            </div>
-                            <div class="layui-form-item">
-                                <div class="layui-inline">
-                                    <label class="layui-form-label">证件类型</label>
-                                    <div class="layui-input-inline">
-                                        <select name="idtype" lay-filter="idtype-filter">
-                                            <option th:each="bean : ${idtypeList}" th:value="${bean.dictval}">[[${bean.dictcaption}]]</option>
-                                        </select>
-                                    </div>
-                                </div>
-                                <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"/>
-                                    </div>
-                                </div>
-                            </div>
-                            <div class="layui-form-item">
-                                <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"/>
-                                    </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"/>
-                                    </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">保存
+                    <div class="layui-card-body">
+                        <div class="layui-form toolbar">
+                            商户状态:
+                            <select id="shop-manager-search-status">
+                                <option value=""> 全部</option>
+                                <option value="normal">正常</option>
+                                <option value="closed">注销</option>
+                                <option value="uncheck">待审核</option>
+                                <option value="reject">驳回</option>
+                            </select>
+                            <input id="shop-manager-search-shopname" class="layui-input search-input" type="text"
+                                   placeholder="商户名称"/>&emsp;
+                            <button id="shop-manager-search-btn" class="layui-btn icon-btn" data-type="search"><i
+                                    class="layui-icon">&#xe615;</i>搜索
                             </button>
-                            <button class="layui-btn layui-btn-primary" type="button" id="cancelbtn">取消
+                            <button id="shop-manager-search-add-btn" class="layui-btn icon-btn" data-type="add"><i
+                                    class="layui-icon">&#xe654;</i>新增
                             </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="继续新增"/>
-                            </div>
+                            <button id="shop-manager-search-reset-btn" class="layui-btn layui-btn-primary"
+                                    data-type="reset"><i class="layui-icon"></i>清 空
+                            </button>
+                            <input type="hidden" id="shop-manager-global-needcheck" th:value="${shopNeedCheck}" />
                         </div>
+                        <table class="layui-table" id="shopManagerTable" lay-filter="shopManagerTable-filter"></table>
                     </div>
                 </div>
             </div>
@@ -167,245 +52,47 @@
     </div>
 </div>
 
+<!-- 表格操作列 -->
+<script type="text/html" id="shop-manager-table-bar">
+    <a class="layui-btn layui-bg-blue layui-btn-xs" lay-event="showShop">查看详情</a>
+    {{# if(d.status !='closed') { }}
+        <a class="layui-btn layui-btn-xs" lay-event="editShop">修改</a>
+        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="delShop">删除</a>
+    {{# } }}
+    {{# if($("#shop-manager-global-needcheck").val() == 'true'){ }}
+        <a class="layui-btn layui-bg-orange layui-btn-xs" lay-event="showShopCheck">审批意见</a>
+    {{# } }}
+</script>
+
 <script>
-    layui.use(['form', 'table', 'layer', 'admin', 'element'], function () {
+    layui.use(['form', 'table', 'layer', 'admin', 'element', 'tree', 'index'], function () {
         var form = layui.form;
         var table = layui.table;
         var admin = layui.admin;
+        var tree = layui.tree;
         var $ = layui.jquery;
+        var index = layui.index;
+        var element = layui.element;
 
         form.render('select');
-        form.verify({
-            "mobile": function (e) {
-                if (null != e && e.length > 0 && !(/^1\d{10}$/.test(e))) {
-                    return "请输入正确的手机号";
-                }
-            },
-            "swEmail": function (e) {
-                if (null != e && e.length > 0 && !(/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(e))) {
-                    return "邮箱格式不正确";
-                }
-            }
-        });
-
-        var initTree = function (nodes) {
-            var menuSetting = {
-                view: {
-                    dblClickExpand: false,
-                    showLine: true,
-                    showIcon: true,
-                    selectedMulti: false,
-                    addHoverDom: addHoverDom,
-                    removeHoverDom: removeHoverDom
-                },
-                data: {
-                    simpleData: {
-                        enable: true
-                    }
-                },
-                edit: {
-                    enable: true,
-                    showRemoveBtn: true,
-                    removeTitle: "删除商户",
-                    showRenameBtn: false,
-                    drag: {
-                        isCopy: false,
-                        isMove: false
-                    }
-                },
-                callback: {
-                    beforeRemove: beforeRemove,
-                    onDblClick: ondblclick
-                }
-            };
-            $.fn.zTree.init($("#shoptree"), menuSetting, nodes);
-        }
-
-        function beforeRemove(treeId, treeNode) {
-            var zTree = $.fn.zTree.getZTreeObj("shoptree");
-            if (treeNode.isParent) {
-                var childrenNodes = treeNode.children;
-                if (childrenNodes && childrenNodes.length !== 0) {
-                    layer.msg("请先删除下级商户", {icon: 2, time: 2000});
-                    return false;
-                }
-            }
-            zTree.selectNode(treeNode);
-            var flag = false;
-            if (confirm("确认删除商户【" + treeNode.name + "】吗?")) {
-                layer.load(2);
-                $.ajax({
-                    type: "POST",
-                    dataType: "json",
-                    url: '[[@{/shop/deleteshop}]]',
-                    async: false,  //必须同步
-                    data: {
-                        shopid: treeNode.id,
-                        _csrf: $("meta[name='_csrf_token']").attr("value")
-                    },
-                    success: function (result) {
-                        console.log(result);
-                        layer.closeAll('loading');
-                        if (result.code === 200) {
-                            layer.msg(result.msg, {icon: 1});
-                            flag = true;
-                        } else if (result.code === 401) {
-                            layer.msg(result.msg, {icon: 2, time: 1500}, function () {
-                                location.replace('[[@{/login}]]');
-                            }, 1000);
-                        } else {
-                            console.log('err:' + result.code);
-                            layer.msg(result.msg, {icon: 2});
-                        }
-                    },
-                    error: function () {
-                        console.log(ret);
-                        layer.closeAll('loading');
-                        layer.msg("请求服务器失败!", {icon: 2});
-                    }
-                });
-            }
-            return flag;
-        }
-
-        function removeHoverDom(treeId, treeNode) {
-            $("#addBtn_" + treeNode.tId).unbind().remove();
-        }
-
-        $('#cancelbtn').click(function () {
-            $("#shop-info").hide();
-        });
-
-        form.on('submit(form-submit-shop-btn)', function (data) {
-            layer.load(2);
-            var vdata = data.field;
-            vdata["_csrf"] = $("meta[name='_csrf_token']").attr("value");
-            $.ajax({
-                type: "POST",
-                dataType: "json",
-                url: '[[@{/shop/saveorupdate}]]',
-                data: vdata,
-                success: function (result) {
-                    layer.closeAll('loading');
-                    debugger
-                    if (result.code === 200) {
-                        var zTree = $.fn.zTree.getZTreeObj("shoptree");
-                        var treeNode = zTree.getNodeByParam("id", '' + result.shop.shopid, null);
-                        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); //修改节点
-                        } else {
-                            var ftreeNode = zTree.getNodeByParam("id", '' + result.shop.fshopid, null);
-                            var newNode = {
-                                id: '' + result.shop.shopid,
-                                pId: '' + result.shop.fshopid,
-                                name: '' + result.shop.shopid + '_' + result.shop.shopname,
-                                shoptype: result.shop.shoptype
-                            }
-                            if (result.shop.shoptype === 'normal') {
-                                newNode["iconSkin"] = "pIcon02";
-                            } else {
-                                newNode["iconSkin"] = "pIcon01";
-                            }
-                            zTree.addNodes(ftreeNode, newNode); //新加树节点
-                        }
-                        layer.msg(result.msg, {icon: 1});
-                        if (!$("#shop-add-continue-flag").is(":checked")) {
-                            $("#shop-info").hide();
-                        }
-                    } else if (result.code === 401) {
-                        layer.msg(result.msg, {icon: 2, time: 1500}, function () {
-                            location.replace('[[@{/login}]]');
-                        }, 1000);
-                    } else {
-                        console.log('err:' + result.code);
-                        layer.msg(result.msg, {icon: 2});
-                    }
-                },
-                error: function () {
-                    layer.closeAll('loading');
-                    layer.msg("请求服务器失败!", {icon: 2});
-                }
-            });
-        });
-
-        function addHoverDom(treeId, treeNode) {
-            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
-                    + "' title='新增下级商户' onfocus='this.blur();'></span>";
-                sObj.after(addStr);
-                var btn = $("#addBtn_" + treeNode.tId);
-                if (btn) btn.bind("click", function () {
-                    form.val("shop-info-form", {
-                        "shopid": "0",
-                        "shopname": "",
-                        "shopaccno": "",
-                        "fshopid": treeNode.id,
-                        "shoptype": "normal",
-                        "zipcode": "",
-                        "addr": "",
-                        "contactman": "",
-                        "idtype": "idcard",
-                        "idno": "",
-                        "mobile": "",
-                        "email": "",
-                        "tel": ""
+        var renderShopTree = function (nodes) {
+            tree.render({
+                elem: '#shop-manager-ztree',
+                data: nodes,
+                showCheckbox: false,
+                accordion: true,
+                click: function (obj) {
+                    var nd = obj.data;
+                    table.reload('shopManagerTable', {
+                        where: {status: '', shopname: '', shopid: nd.id},
+                        page: {curr: 1}
                     });
-                    $("#fshopid").attr("readonly", "readonly");
-                    $("#shoptype option[value='root']").remove();
-                    $("#shoptype").removeAttr("disabled");
-                    form.render('select');
-                    $("#submitbtn-shop-btn").text("新增");
-                    $("#shop-add-continue-flag").prop("checked", false);
-                    $("#shop-add-hid-div").show();
-                    $("#shop-info").show();
-                    return false;
-                });
-            }
-        }
-
-        function ondblclick(event, treeId, treeNode) {
-            admin.dgo('[[@{/shop/getshopinfo}]]', {
-                "shopid": treeNode.id
-            }, function (data) {
-                console.log("getshopinfo返回", data);
-                if (data.code === 200) {
-                    debugger
-                    var root_index = $("#shoptype option[value='root']").attr("index");
-                    if(undefined == root_index){
-                        $("#shoptype").append("<option value=\"root\">根商户</option>");
-                    }
-                    if(null==data.shop.idtype){
-                        data.shop["idtype"]="idcard"
-                    }
-                    form.val("shop-info-form", data.shop);
-                    $("#fshopid").removeAttr("readonly");
-                    $("#shoptype").attr('disabled', 'disabled');
-                    form.render('select');
-                    $("#submitbtn-shop-btn").text("保存");
-                    $("#shop-add-continue-flag").prop("checked", false);
-                    $("#shop-add-hid-div").hide();
-                    $("#shop-info").show();
-                } else if (data.code === 401) {
-                    layer.msg(data.msg, {icon: 2, time: 1500}, function () {
-                        location.replace('[[@{/login}]]');
-                    }, 1000);
-                } else {
-                    layer.msg(data.msg, {icon: 2, time: 2000});
                 }
-            }, function (ret) {
-                console.log(ret);
-                layer.msg('查询商户失败了,请求服务器异常', {icon: 2});
             });
         }
-
         admin.dgo('[[@{/shop/shoptree}]]', {}, function (data) {
             if (data.code === 200) {
-                initTree(data.data);
+                renderShopTree(data.data);
             } else if (data.code === 401) {
                 layer.msg(data.msg, {icon: 2, time: 1500}, function () {
                     location.replace('[[@{/login}]]');
@@ -417,5 +104,151 @@
             console.log(ret);
             layer.msg('查询商户树失败了,请稍后再试', {icon: 2});
         });
+
+        $('#shop-manager-search-reset-btn').click(function () {
+            $("#shop-manager-search-status").val("");
+            $("#shop-manager-search-shopname").val("");
+            form.render('select');
+        });
+
+        $('#shop-manager-search-btn').click(function () {
+            table.reload('shopManagerTable', {
+                where: {
+                    status: $("#shop-manager-search-status").val(),
+                    shopname: $("#shop-manager-search-shopname").val(),
+                    shopid: null
+                }, page: {curr: 1}
+            });
+        });
+
+        $("#shop-manager-search-add-btn").click(function () {
+            // element.tabDelete('admin-pagetabs', '_shop_manager_add');
+            index.openNewTab({
+                url: "[[@{/shop/load4addshop}]]",
+                menuId: '_shop_manager_add',
+                title: '新增商户'
+            });
+        });
+
+        // 渲染表格
+        table.render({
+            elem: '#shopManagerTable',
+            url: '[[@{/shop/shoplist}]]',
+            page: true,
+            width: 1010,
+            cols: [
+                [   {align: 'center', title: '操作', align: 'center', width: 260, fixed: 'left', toolbar: '#shop-manager-table-bar'},
+                    {
+                        field: 'shopid',
+                        title: '商户号',
+                        width: 100,
+                        align: 'center',
+                        sort: true
+                    },
+                    {field: 'shopname', title: '商户名称', align: 'center', sort: true},
+                    {
+                        field: 'status', title: '商户状态', width: 110, align: 'center', sort: true, templet: function (e) {
+                            if (e.status == 'uncheck') {
+                                return '<span class="layui-badge layui-bg-orange">待审核</span>';
+                            } else if (e.status == 'normal') {
+                                return '<span class="layui-badge layui-bg-green">正常</span>';
+                            } else if (e.status == 'closed') {
+                                return '<span class="layui-badge layui-bg-gray">注销</span>';
+                            } else if (e.status == 'reject') {
+                                return '<span class="layui-badge">驳回</span>';
+                            } else {
+                                return e.status;
+                            }
+                        }
+                    },
+                    {
+                        field: 'shoptype',
+                        title: '商户类型',
+                        align: 'center',
+                        width: 110,
+                        sort: true,
+                        templet: function (e) {
+                            if (e.shoptype == 'root') {
+                                return '根节点';
+                            } else if (e.shoptype == 'group') {
+                                return '商户组';
+                            } else if (e.shoptype == 'normal') {
+                                return '结算商户';
+                            } else {
+                                return e.shoptype
+                            }
+                        }
+                    },
+                    {
+                        field: 'shopaccno',
+                        title: '商户账号',
+                        align: 'center',
+                        width: 120,
+                        sort: true,
+                        templet: function (e) {
+                            if (null != e.shopaccno && '' != e.shopaccno) {
+                                return e.shopaccno;
+                            } else {
+                                return '-';
+                            }
+                        }
+                    }
+                ]
+            ]
+        });
+
+        //监听单元格
+        table.on('tool(shopManagerTable-filter)', function (obj) {
+            var data = obj.data;
+            if('showShop' == obj.event){
+                //查看详情
+                element.tabDelete('admin-pagetabs', '_shop_manager_detail');
+                index.openNewTab({
+                    url: "[[@{/shop/getshopinfo}]]?shopid="+data.shopid,
+                    menuId: '_shop_manager_detail',
+                    title: '商户详情'
+                });
+            }else if('editShop' == obj.event){
+                //修改
+                element.tabDelete('admin-pagetabs', '_shop_manager_update');
+                index.openNewTab({
+                    url: "[[@{/shop/load4updateshop}]]?shopid="+data.shopid,
+                    menuId: '_shop_manager_update',
+                    title: '修改商户'
+                });
+            }else if('delShop' == obj.event){
+                //删除
+                layer.confirm("确定要删除该商户吗?", function () {
+                    var token = $("meta[name='_csrf_token']").attr("value");
+                    admin.go('[[@{/shop/deleteshop}]]', {
+                        shopid: data.shopid,
+                        _csrf: token
+                    }, function (data) {
+                        if (data.code === 200) {
+                            layer.msg(data.msg, {icon: 1, time: 1000});
+                            // table.reload('shopManagerTable');
+                            admin.refresh();
+                        } else if (data.code === 401) {
+                            layer.msg(data.msg, {icon: 2, time: 1500}, function () {
+                                location.replace('[[@{/login}]]');
+                            }, 1000);
+                        } else {
+                            layer.msg(data.msg, {icon: 2});
+                            return;
+                        }
+                    }, function (err) {
+                        admin.errorBack(err);
+                    });
+                });
+            }else if('showShopCheck' == obj.event){
+                //审核意见
+                element.tabDelete('admin-pagetabs', '_shop_manager_chkdtl');
+                index.openNewTab({
+                    url: "[[@{/shop/getshopchk}]]?shopid="+data.shopid,
+                    menuId: '_shop_manager_chkdtl',
+                    title: '审批意见'
+                });
+            }
+        });
     });
 </script>
\ No newline at end of file
diff --git a/payapi/src/main/resources/templates/system/shop/opercheck.html b/payapi/src/main/resources/templates/system/shop/opercheck.html
new file mode 100644
index 0000000..c9450e7
--- /dev/null
+++ b/payapi/src/main/resources/templates/system/shop/opercheck.html
@@ -0,0 +1,239 @@
+<div class="layui-card">
+    <div class="layui-card-header">
+        <h2 class="header-title">审核商户</h2>
+        <span class="layui-breadcrumb pull-right">
+          <a href="#!_shop_shopcheck">商户审批</a>
+          <a><cite>审核商户</cite></a>
+        </span>
+    </div>
+    <div class="layui-card-body">
+        <div class="layui-form toolbar" lay-filter="shop-check-info-form">
+            <div class="layui-card-header">商户基本信息</div>
+            <div class="layui-form-item" style="margin-left: 15px;margin-top: 15px;">
+                <label class="layui-form-label" style="color: red;width: 100px;"><span
+                        style="color: red;">*</span>商户类型</label>
+                <div class="layui-input-inline">
+                    <div th:if="${shop.shoptype} eq 'root' " class="layui-input" style="padding-top: 8px;">根节点</div>
+                    <div th:if="${shop.shoptype} eq 'group' " class="layui-input" style="padding-top: 8px;">商户组</div>
+                    <div th:if="${shop.shoptype} eq 'normal' " class="layui-input" style="padding-top: 8px;">结算商户</div>
+                </div>
+                <div class="layui-form-mid layui-word-aux">
+                    注意:商户组无商户账号,且能创建下级商户。结算商户是叶子商户,会创建商户账号。保存后无法修改!!!
+                </div>
+            </div>
+            <div class="layui-card-body">
+                <div class="layui-form-item">
+                    <div class="layui-inline">
+                        <label class="layui-form-label" style="width: 100px;">商户号</label>
+                        <div class="layui-input-inline">
+                            <div class="layui-input" style="padding-top: 8px;">[[${shop.shopid}]]</div>
+                        </div>
+                    </div>
+                    <div class="layui-inline">
+                        <label class="layui-form-label" style="width: 100px;">商户账号</label>
+                        <div class="layui-input-inline">
+                            <div class="layui-input" style="padding-top: 8px;">[[${shop.shopaccno}]]</div>
+                        </div>
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <div class="layui-inline">
+                        <label class="layui-form-label" style="width: 100px;"><span
+                                style="color: red;">*</span>上级商户号</label>
+                        <div class="layui-input-inline">
+                            <div class="layui-input" style="padding-top: 8px;">[[${shop.fshopname}]]</div>
+                        </div>
+                    </div>
+                    <div class="layui-inline">
+                        <label class="layui-form-label" style="width: 100px;"><span
+                                style="color: red;">*</span>商户名</label>
+                        <div class="layui-input-inline">
+                            <div class="layui-input" style="padding-top: 8px;">[[${shop.shopname}]]</div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+            <div class="layui-card-header">商户营业信息</div>
+            <div class="layui-card-body">
+                <div class="layui-form-item" style="margin-left: 15px;margin-top: 15px;">
+                    <label class="layui-form-label" style="width: 90px;"><span
+                            style="color: red;">*</span>营业执照编号</label>
+                    <div class="layui-input-inline" style="width: 525px;">
+                        <div class="layui-input" style="padding-top: 8px;">[[${shop.businessLicenseNo}]]</div>
+                    </div>
+                </div>
+
+                <div class="layui-form-item" style="margin-left: 15px;">
+                    <label class="layui-form-label" style="width: 90px;"><span
+                            style="color: red;">*</span>税务登记证号</label>
+                    <div class="layui-input-inline" style="width: 525px;">
+                        <div class="layui-input" style="padding-top: 8px;">[[${shop.taxRegistrationNo}]]</div>
+                    </div>
+                </div>
+
+                <div class="layui-form-item" style="margin-left: 15px;">
+                    <label class="layui-form-label" style="width: 90px;"><span
+                            style="color: red;">*</span>商户经营地址</label>
+                    <div class="layui-input-inline" style="width: 525px;">
+                        <div class="layui-input" style="padding-top: 8px;">[[${shop.addr}]]</div>
+                    </div>
+                </div>
+
+                <div class="layui-form-item" style="margin-left: 15px;">
+                    <label class="layui-form-label" style="width: 90px;"><span style="color: red;">*</span>法人姓名</label>
+                    <div class="layui-input-inline" style="width: 525px;">
+                        <div class="layui-input" style="padding-top: 8px;">[[${shop.legalPersonName}]]</div>
+                    </div>
+                </div>
+
+                <div class="layui-form-item" style="margin-left: 15px;">
+                    <div class="layui-inline">
+                        <label class="layui-form-label" style="width: 90px;"><span
+                                style="color: red;">*</span>法人证件类型</label>
+                        <div class="layui-input-inline">
+                            <div class="layui-input" style="padding-top: 8px;">[[${shop.legalPersonIdtype}]]</div>
+                        </div>
+                    </div>
+                    <div class="layui-inline">
+                        <label class="layui-form-label" style="width: 90px;"><span
+                                style="color: red;">*</span>法人证件号</label>
+                        <div class="layui-input-inline">
+                            <div class="layui-input" style="padding-top: 8px;">[[${shop.legalPersonIdno}]]</div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+            <div class="layui-card-header">商户联系人信息</div>
+            <div class="layui-card-body">
+                <div class="layui-form-item">
+                    <div class="layui-inline">
+                        <label class="layui-form-label" style="width: 100px;">姓名</label>
+                        <div class="layui-input-inline">
+                            <div class="layui-input" style="padding-top: 8px;">[[${shop.contactman}]]</div>
+                        </div>
+                    </div>
+                    <div class="layui-inline">
+                        <label class="layui-form-label" style="width: 100px;">手机号</label>
+                        <div class="layui-input-inline">
+                            <div class="layui-input" style="padding-top: 8px;">[[${shop.mobile}]]</div>
+                        </div>
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <div class="layui-inline">
+                        <label class="layui-form-label" style="width: 100px;">邮箱</label>
+                        <div class="layui-input-inline">
+                            <div class="layui-input" style="padding-top: 8px;">[[${shop.email}]]</div>
+                        </div>
+                    </div>
+                    <div class="layui-inline">
+                        <label class="layui-form-label" style="width: 100px;">电话</label>
+                        <div class="layui-input-inline">
+                            <div class="layui-input" style="padding-top: 8px;">[[${shop.tel}]]</div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div class="layui-card-header">商户审核</div>
+            <div class="layui-card-body" style="padding-left: 0;margin-bottom: 15px;">
+                <div style="padding: 20px 0;background-color: #f8f8f8;">
+                    <div class="layui-form-item" style="margin-left: 15px;">
+                        <label class="layui-form-label" style="width: 90px;">审批流程号:</label>
+                        <div class="layui-input-inline">
+                            <div class="layui-input" style="padding-top: 8px;">[[${operChkdtl.chkNo}]]</div>
+                            <input type="hidden" id="hidden-shop-oper-check-chkno" th:value="${operChkdtl.chkNo}"/>
+                        </div>
+                    </div>
+                    <div class="layui-form-item" style="margin-left: 15px;">
+                        <label class="layui-form-label" style="width: 90px;">操作类型:</label>
+                        <div class="layui-input-inline">
+                            <div class="layui-input" style="padding-top: 8px;color: red;">[[${operChkdtl.chkMode}]]商户
+                            </div>
+                        </div>
+                    </div>
+                    <div class="layui-form-item" style="margin-left: 15px;">
+                        <label class="layui-form-label" style="width: 90px;color: red;">审核意见:</label>
+                        <div class="layui-input-inline" style="width: 525px;">
+                            <textarea placeholder="请输入意见" class="layui-textarea" id="shop-oper-check-chkmsg" maxlength="200"></textarea>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div class="layui-form-item" style="padding-bottom: 20px;text-align: center;">
+                <button class="layui-btn" type="button" id="submitbtn-shop-check-pass-btn">同 意
+                </button>
+                <button class="layui-btn layui-btn-danger" type="button" id="submitbtn-shop-check-reject-btn">驳 回
+                </button>
+                <button class="layui-btn layui-btn-primary" type="button" id="submitbtn-shop-check-return-btn">返 回
+                </button>
+            </div>
+        </div>
+    </div>
+</div>
+
+<script>
+    layui.use(['form', 'table', 'admin', 'jquery', 'element'], function () {
+        var form = layui.form;
+        var admin = layui.admin;
+        var $ = layui.jquery;
+        var element = layui.element;
+
+        $("#submitbtn-shop-check-return-btn").click(function () {
+            element.tabDelete('admin-pagetabs', '_shop_operchk_check'); //关闭现有详情
+            element.tabChange('admin-pagetabs', '_shop_shopcheck');
+            admin.refresh();
+        });
+
+        $("#submitbtn-shop-check-pass-btn").click(function () {
+            var chkmsg = $("#shop-oper-check-chkmsg").val();
+            // layer.confirm("确定同意吗?", function () {
+                doShopCheck('normal', chkmsg);
+            // });
+        });
+
+        $("#submitbtn-shop-check-reject-btn").click(function () {
+            var chkmsg = $("#shop-oper-check-chkmsg").val();
+            if(isempty(chkmsg)){
+                layer.msg("驳回时必须填写审核意见", {icon: 2, time: 1500});
+                return;
+            }
+             // layer.confirm("确定驳回吗?", function () {
+                doShopCheck('reject', chkmsg);
+            // });
+        });
+
+        function doShopCheck(type, msg) {
+            var chkno = $("#hidden-shop-oper-check-chkno").val();
+            var token = $("meta[name='_csrf_token']").attr("value");
+            admin.go('[[@{/shop/docheckshop}]]', {
+                chkno: chkno,
+                chkresult: type,
+                chkmsg: msg,
+                _csrf: token
+            }, function (data) {
+                if (data.code === 200) {
+                    layer.msg(data.msg, {icon: 1, time: 1000});
+                    element.tabDelete('admin-pagetabs', '_shop_operchk_check'); //关闭现有详情
+                    element.tabChange('admin-pagetabs', '_shop_shopcheck');
+                    admin.refresh();
+                } else if(data.code === 299){
+                    layer.msg('审核操作成功,但必须驳回! '+data.msg, {icon: 2, time: 1000});
+                    element.tabDelete('admin-pagetabs', '_shop_operchk_check'); //关闭现有详情
+                    element.tabChange('admin-pagetabs', '_shop_shopcheck');
+                    admin.refresh();
+                } else if (data.code === 401) {
+                    layer.msg(data.msg, {icon: 2, time: 1500}, function () {
+                        location.replace('[[@{/login}]]');
+                    }, 1000);
+                } else {
+                    layer.msg(data.msg, {icon: 2});
+                    return;
+                }
+            }, function (err) {
+                admin.errorBack(err);
+            });
+        }
+    });
+</script>
\ No newline at end of file
diff --git a/payapi/src/main/resources/templates/system/shop/shopcheck.html b/payapi/src/main/resources/templates/system/shop/shopcheck.html
new file mode 100644
index 0000000..270c86a
--- /dev/null
+++ b/payapi/src/main/resources/templates/system/shop/shopcheck.html
@@ -0,0 +1,134 @@
+<div class="layui-card">
+    <div class="layui-card-header">
+        <h2 class="header-title">商户审批</h2>
+        <span class="layui-breadcrumb pull-right">
+          <a href="#">商户中心</a>
+          <a><cite>商户审批</cite></a>
+        </span>
+    </div>
+    <div class="layui-card-body">
+        <div class="layui-form toolbar">
+            搜索:
+            <input id="search-shop-operchk-searchkey" class="layui-input search-input" type="text" maxlength="30"
+                   style="width: 280px;" placeholder="输入审批流程编号,申请人,审核人查询"/>
+            <select id="search-shop-operchk-status" class="layui-select search-input">
+                <option value="">选择状态</option>
+                <option value="uncheck">待审核</option>
+                <option value="normal">同意</option>
+                <option value="reject">驳回</option>
+            </select>
+            <button id="btn-search-shop-operchk" class="layui-btn icon-btn" data-type="search"><i class="layui-icon">&#xe615;</i>搜索
+            </button>
+            <button id="btn-reset-shop-operchk" class="layui-btn layui-btn-primary" data-type="reset"><i
+                    class="layui-icon"></i>清 空
+            </button>
+        </div>
+        <table class="layui-table" id="shopOperchkTable" lay-filter="shopOperchkTable-filter"></table>
+    </div>
+</div>
+
+<!-- 表格操作列 -->
+<script type="text/html" id="shop-operchk-table-bar">
+    {{# if(d.chkResult =='uncheck') { }}
+        <a class="layui-btn layui-btn-xs" lay-event="checkShop">审核</a>
+    {{# } }}
+</script>
+
+<script>
+    layui.use(['form', 'table', 'layer', 'admin', 'element', 'index'], function () {
+        var form = layui.form;
+        var table = layui.table;
+        var admin = layui.admin;
+        var element = layui.element;
+        var index = layui.index;
+
+        form.render("select");
+        // 渲染表格
+        table.render({
+            elem: '#shopOperchkTable',
+            url: '[[@{/shop/shopchecklist}]]',
+            page: true,
+            cols: [
+                [
+                    {align: 'center', title: '操作', align: 'center', width: 80, fixed: 'left', toolbar: '#shop-operchk-table-bar'},
+                    {field: 'chkNo', title: '审批流程编号', align: 'center', width: 140, fixed: 'left', sort: true},
+                    {
+                        field: 'createOpername',
+                        title: '申请人',
+                        width: 150,
+                        align: 'center'
+                    },
+                    {
+                        field: 'createtime',
+                        title: '申请时间',
+                        align: 'center',
+                        width: 190,
+                        sort: true,
+                        templet: function (e) {
+                            return admin.formatDate(e.createtime);
+                        }
+                    },
+                    {
+                        field: 'chkMode', title: '操作类型', align: 'center', width: 100, templet: function (e) {
+                            return e.chkMode + '商户';
+                        }
+                    },
+                    {
+                        field: 'chkResult', title: '状态', align: 'center', width: 100, templet: function (e) {
+                            if ("uncheck" == e.chkResult) {
+                                return '<span class="layui-badge layui-bg-orange">待审核</span>';
+                            } else if ("normal" == e.chkResult) {
+                                return '<span class="layui-badge layui-bg-green">同意</span>';
+                            } else if ("reject" == e.chkResult) {
+                                return '<span class="layui-badge">驳回</span>';
+                            } else {
+                                return e.chkResult;
+                            }
+                        }
+                    },
+                    {field: 'chkMsg', title: '审核意见', align: 'center'},
+                    {field: 'checkOpername', title: '审核人', align: 'center', width: 150},
+                    {
+                        field: 'checktime',
+                        title: '审核时间',
+                        align: 'center',
+                        width: 190,
+                        sort: true,
+                        templet: function (e) {
+                            return admin.formatDate(e.checktime);
+                        }
+                    }
+                ]
+            ]
+        });
+
+        // 搜索按钮点击事件
+        $('#btn-search-shop-operchk').click(function () {
+            table.reload('shopOperchkTable', {
+                where: {
+                    status: $("#search-shop-operchk-status").val(),
+                    searchkey: $("#search-shop-operchk-searchkey").val()
+                }, page: {curr: 1}
+            });
+        });
+
+        $('#btn-reset-shop-operchk').click(function () {
+            $("#search-shop-operchk-status").val("");
+            $("#search-shop-operchk-searchkey").val("");
+        });
+
+        //监听单元格
+        table.on('tool(shopOperchkTable-filter)', function (obj) {
+            var data = obj.data;
+            if('checkShop' == obj.event){
+                //查看详情
+                element.tabDelete('admin-pagetabs', '_shop_operchk_check');
+                index.openNewTab({
+                    url: "[[@{/shop/opercheck}]]?chkno="+data.chkNo,
+                    menuId: '_shop_operchk_check',
+                    title: '审核商户'
+                });
+            }
+        });
+    });
+</script>
\ No newline at end of file
diff --git a/payapi/src/main/resources/templates/system/shop/shopchk.html b/payapi/src/main/resources/templates/system/shop/shopchk.html
new file mode 100644
index 0000000..ed8e62d
--- /dev/null
+++ b/payapi/src/main/resources/templates/system/shop/shopchk.html
@@ -0,0 +1,144 @@
+<div class="layui-card">
+    <div class="layui-card-header">
+        <h2 class="header-title">审批意见</h2>
+        <span class="layui-breadcrumb pull-right">
+          <a href="#!_shop_index">商户管理</a>
+          <a><cite>审批意见</cite></a>
+        </span>
+    </div>
+    <div class="layui-card-body">
+        <div class="layui-form" lay-filter="shop-manager-chkdtl-search-form">
+            <div class="layui-form-item" style="margin-bottom: 0;">
+                <div class="layui-inline">
+                    <label class="layui-form-label">关键字</label>
+                    <div class="layui-input-block" style="width: 300px;">
+                        <input type="text" name="searchkey" id="shop-manager-chkdtl-search--searchkey"
+                               class="layui-input"
+                               placeholder="输入审批流程编号,申请人,审核人查询"/>
+                    </div>
+                </div>
+                <div class="layui-inline">
+                    <label class="layui-form-label">审核状态</label>
+                    <div class="layui-input-block" style="width: 260px;">
+                        <select name="status" id="shop-manager-chkdtl-search-status" class="layui-select">
+                            <option value="">请选择</option>
+                            <option value="uncheck">待审核</option>
+                            <option value="normal">同意</option>
+                            <option value="reject">驳回</option>
+                        </select>
+                    </div>
+                </div>
+                <div class="layui-inline">
+                    <input type="hidden" name="shopid" id="shop-manager-chkdtl-search-shopid"
+                           th:value="${selectShopid}"/>
+                </div>
+                <div class="layui-inline" style="margin-left: 20px;">
+                    <button id="shop-manager-chkdtl-search-btn" class="layui-btn icon-btn" data-type="search"><i
+                            class="layui-icon">&#xe615;</i>搜索
+                    </button>
+                    <button id="shop-manager-chkdtl-return-btn" class="layui-btn layui-btn-warm">返回</button>
+                    <button id="shop-manager-chkdtl-reset-btn" class="layui-btn layui-btn-primary" data-type="reset">清空
+                    </button>
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="layui-card-body">
+        <table class="layui-table" id="shopManagerChkdtlTable" lay-filter="shopManagerChkdtlTable-filter"></table>
+    </div>
+</div>
+
+<!--<script type="text/html" id="shop-manager-chkdtl-toolbar">-->
+<!--<div class="layui-btn-container"></div>-->
+<!--</script>-->
+
+<script>
+    layui.use(['form', 'table', 'admin', 'element'], function () {
+        var form = layui.form;
+        var table = layui.table;
+        var admin = layui.admin;
+        var element = layui.element;
+
+        form.render("select");
+
+        // 渲染表格
+        var renderTable = function (obj) {
+            table.render({
+                id: 'shopManagerChkdtlTable',
+                title: '审批意见',
+                elem: '#shopManagerChkdtlTable',
+                url: '[[@{/shop/getshopchklist}]]',
+                page: true,
+                where: obj,
+                // toolbar: '#shop-manager-chkdtl-toolbar',
+                cols: [
+                    [
+                        {field: 'chkNo', title: '审批流程编号', align: 'center', width: 140, fixed: 'left', sort: true},
+                        {
+                            field: 'createOpername',
+                            title: '申请人',
+                            width: 150,
+                            align: 'center'
+                        },
+                        {
+                            field: 'createtime',
+                            title: '申请时间',
+                            align: 'center',
+                            width: 190,
+                            sort: true,
+                            templet: function (e) {
+                                return admin.formatDate(e.createtime);
+                            }
+                        },
+                        {field: 'chkMode', title: '操作类型', align: 'center', width: 100},
+                        {
+                            field: 'chkResult', title: '状态', align: 'center', width: 100, templet: function (e) {
+                                if ("uncheck" == e.chkResult) {
+                                    return '<span class="layui-badge layui-bg-orange">待审核</span>';
+                                } else if ("normal" == e.chkResult) {
+                                    return '<span class="layui-badge layui-bg-green">同意</span>';
+                                } else if ("reject" == e.chkResult) {
+                                    return '<span class="layui-badge">驳回</span>';
+                                } else {
+                                    return e.chkResult;
+                                }
+                            }
+                        },
+                        {field: 'chkMsg', title: '审核意见', align: 'center'},
+                        {field: 'checkOpername', title: '审核人', align: 'center', width: 150},
+                        {
+                            field: 'checktime', title: '审核时间', align: 'center', width: 190, sort: true, templet: function (e) {
+                                return admin.formatDate(e.checktime);
+                            }
+                        }
+                    ]
+                ]
+            });
+        }
+        renderTable({
+            shopid: $("#shop-manager-chkdtl-search-shopid").val()
+        });
+
+        $("#shop-manager-chkdtl-search-btn").click(function () {
+            table.reload('shopManagerChkdtlTable', {
+                where: {
+                    shopid: $("#shop-manager-chkdtl-search-shopid").val(),
+                    status: $("#shop-manager-chkdtl-search-status").val(),
+                    searchkey: $("#shop-manager-chkdtl-search--searchkey").val(),
+                }, page: {curr: 1}
+            });
+        });
+
+        $("#shop-manager-chkdtl-reset-btn").click(function () {
+            $("#shop-manager-chkdtl-search-status").val("");
+            $("#shop-manager-chkdtl-search--searchkey").val("");
+            form.render("select");
+        });
+
+        $("#shop-manager-chkdtl-return-btn").click(function () {
+            element.tabDelete('admin-pagetabs', '_shop_manager_chkdtl'); //关闭现有详情
+            element.tabChange('admin-pagetabs', '_shop_index');
+            // admin.refresh();
+        });
+    });
+</script>
\ No newline at end of file
diff --git a/payapi/src/main/resources/templates/system/shop/shopdetail.html b/payapi/src/main/resources/templates/system/shop/shopdetail.html
new file mode 100644
index 0000000..148225a
--- /dev/null
+++ b/payapi/src/main/resources/templates/system/shop/shopdetail.html
@@ -0,0 +1,209 @@
+<div class="layui-card">
+    <div class="layui-card-header">
+        <h2 class="header-title">商户详情</h2>
+        <span class="layui-breadcrumb pull-right">
+          <a href="#!_shop_index">商户管理</a>
+          <a><cite>商户详情</cite></a>
+        </span>
+    </div>
+    <div class="layui-card-body">
+        <div id="shop-detail-info" class="layui-form toolbar" lay-filter="shop-detail-info-form">
+            <div class="layui-card-header">商户基本信息</div>
+            <div class="layui-form-item" style="margin-left: 15px;margin-top: 15px;">
+                <label class="layui-form-label" style="color: red;width: 100px;"><span
+                        style="color: red;">*</span>商户类型</label>
+                <div class="layui-input-inline">
+                    <select name="shoptype" id="shop-detail-shoptype" lay-filter="shop-detail-shoptype-filter"
+                            lay-verify="required" disabled="disabled">
+                        <option value="root" th:selected="${shop.shoptype=='root'}">根节点</option>
+                        <option value="group" th:selected="${shop.shoptype=='group'}">商户组</option>
+                        <option value="normal" th:selected="${shop.shoptype=='normal'}">结算商户</option>
+                    </select>
+                </div>
+                <div class="layui-form-mid layui-word-aux">
+                    注意:商户组无商户账号,且能创建下级商户。结算商户是叶子商户,会创建商户账号。保存后无法修改!!!
+                </div>
+            </div>
+            <div class="layui-card-body">
+                <div class="layui-form-item">
+                    <div class="layui-inline">
+                        <label class="layui-form-label" style="width: 100px;">商户号</label>
+                        <div class="layui-input-inline">
+                            <div class="layui-input" style="padding-top: 8px;">[[${shop.shopid}]]</div>
+                            <input type="hidden" id="hidden-shop-detail-fshopid" th:value="${shop.fshopid}"/>
+                        </div>
+                    </div>
+                    <div class="layui-inline">
+                        <label class="layui-form-label" style="width: 100px;">商户账号</label>
+                        <div class="layui-input-inline">
+                            <div class="layui-input" style="padding-top: 8px;">[[${shop.shopaccno}]]</div>
+                        </div>
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <div class="layui-inline">
+                        <label class="layui-form-label" style="width: 100px;"><span
+                                style="color: red;">*</span>上级商户号</label>
+                        <div class="layui-input-inline">
+                            <input type="text" name="fshopid" id="shop-detail-fshopid" lay-filter="shop-detail-fshopid"
+                                   class="layui-input" autocomplete="off" placeholder="请选择"
+                                   lay-verify="required|number"/>
+                        </div>
+                    </div>
+                    <div class="layui-inline">
+                        <label class="layui-form-label" style="width: 100px;"><span
+                                style="color: red;">*</span>商户名</label>
+                        <div class="layui-input-inline">
+                            <div class="layui-input" style="padding-top: 8px;">[[${shop.shopname}]]</div>
+                        </div>
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <div class="layui-inline">
+                        <label class="layui-form-label" style="width: 100px;color: red;">商户状态</label>
+                        <div class="layui-input-inline">
+                            <div th:if="${shop.status} eq 'uncheck' " class="layui-input" style="padding-top: 8px;color: orange;font-weight: bold;font-size: 16px;">待审核</div>
+                            <div th:if="${shop.status} eq 'normal' " class="layui-input" style="padding-top: 8px;color: green;font-weight: bold;font-size: 16px;">正 常</div>
+                            <div th:if="${shop.status} eq 'closed' " class="layui-input" style="padding-top: 8px;color: #ddd;font-weight: bold;font-size: 16px;">注 销</div>
+                            <div th:if="${shop.status} eq 'reject' " class="layui-input" style="padding-top: 8px;color: red;font-weight: bold;font-size: 16px;">驳 回</div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+            <div class="layui-card-header">商户营业信息</div>
+            <div class="layui-card-body">
+                <div class="layui-form-item" style="margin-left: 15px;margin-top: 15px;">
+                    <label class="layui-form-label" style="width: 90px;"><span
+                            style="color: red;">*</span>营业执照编号</label>
+                    <div class="layui-input-inline" style="width: 525px;">
+                        <div class="layui-input" style="padding-top: 8px;">[[${shop.businessLicenseNo}]]</div>
+                    </div>
+                </div>
+
+                <div class="layui-form-item" style="margin-left: 15px;">
+                    <label class="layui-form-label" style="width: 90px;"><span
+                            style="color: red;">*</span>税务登记证号</label>
+                    <div class="layui-input-inline" style="width: 525px;">
+                        <div class="layui-input" style="padding-top: 8px;">[[${shop.taxRegistrationNo}]]</div>
+                    </div>
+                </div>
+
+                <div class="layui-form-item" style="margin-left: 15px;">
+                    <label class="layui-form-label" style="width: 90px;"><span
+                            style="color: red;">*</span>商户经营地址</label>
+                    <div class="layui-input-inline" style="width: 525px;">
+                        <div class="layui-input" style="padding-top: 8px;">[[${shop.addr}]]</div>
+                    </div>
+                </div>
+
+                <div class="layui-form-item" style="margin-left: 15px;">
+                    <label class="layui-form-label" style="width: 90px;"><span style="color: red;">*</span>法人姓名</label>
+                    <div class="layui-input-inline" style="width: 525px;">
+                        <div class="layui-input" style="padding-top: 8px;">[[${shop.legalPersonName}]]</div>
+                    </div>
+                </div>
+
+                <div class="layui-form-item" style="margin-left: 15px;">
+                    <div class="layui-inline">
+                        <label class="layui-form-label" style="width: 90px;"><span
+                                style="color: red;">*</span>法人证件类型</label>
+                        <div class="layui-input-inline">
+                            <select name="legalPersonIdtype" id="shop-detail-legalPersonIdtype" th:field="*{shop.legalPersonIdtype}"
+                                    lay-filter="shop-detail-legalPersonIdtype-filter" class="layui-select" disabled="disabled">
+                                <option th:each="bean : ${idtypeList}" th:value="${bean.dictval}">[[${bean.dictcaption}]]</option>
+                            </select>
+                        </div>
+                    </div>
+                    <div class="layui-inline">
+                        <label class="layui-form-label" style="width: 90px;"><span
+                                style="color: red;">*</span>法人证件号</label>
+                        <div class="layui-input-inline">
+                            <div class="layui-input" style="padding-top: 8px;">[[${shop.legalPersonIdno}]]</div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+            <div class="layui-card-header">商户联系人信息</div>
+            <div class="layui-card-body">
+                <div class="layui-form-item">
+                    <div class="layui-inline">
+                        <label class="layui-form-label" style="width: 100px;">姓名</label>
+                        <div class="layui-input-inline">
+                            <div class="layui-input" style="padding-top: 8px;">[[${shop.contactman}]]</div>
+                        </div>
+                    </div>
+                    <div class="layui-inline">
+                        <label class="layui-form-label" style="width: 100px;">手机号</label>
+                        <div class="layui-input-inline">
+                            <div class="layui-input" style="padding-top: 8px;">[[${shop.mobile}]]</div>
+                        </div>
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <div class="layui-inline">
+                        <label class="layui-form-label" style="width: 100px;">邮箱</label>
+                        <div class="layui-input-inline">
+                            <div class="layui-input" style="padding-top: 8px;">[[${shop.email}]]</div>
+                        </div>
+                    </div>
+                    <div class="layui-inline">
+                        <label class="layui-form-label" style="width: 100px;">电话</label>
+                        <div class="layui-input-inline">
+                            <div class="layui-input" style="padding-top: 8px;">[[${shop.tel}]]</div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div class="layui-form-item" style="padding-bottom: 20px;text-align: center;">
+                <button class="layui-btn layui-btn-primary" type="button" id="submitbtn-shop-detail-return-btn">返回
+                </button>
+            </div>
+        </div>
+    </div>
+</div>
+
+<script>
+    layui.use(['form', 'table', 'admin', 'jquery', 'element', 'treeSelect'], function () {
+        var form = layui.form;
+        var admin = layui.admin;
+        var $ = layui.jquery;
+        var element = layui.element;
+        var treeSelect = layui.treeSelect;
+
+        form.render("select");
+
+        treeSelect.render({
+            elem: '#shop-detail-fshopid',
+            data: '[[@{/shop/selectshopgroup}]]',
+            type: 'get',
+            placeholder: '请选择',
+            search: false,
+            style: {
+                folder: {
+                    enable: false
+                },
+                line: {
+                    enable: true
+                }
+            },
+            // 点击回调
+            click: function (d) {
+                var treeNode = d.current;
+                return true;
+            },
+            success: function (d) {
+                console.log(d); // 加载完成后的回调函数
+                var df = $("#hidden-shop-detail-fshopid").val();
+                treeSelect.checkNode('shop-detail-fshopid', df);
+                treeSelect.disabled();
+            }
+        });
+
+        $("#submitbtn-shop-detail-return-btn").click(function () {
+            element.tabDelete('admin-pagetabs', '_shop_manager_detail'); //关闭现有详情
+            element.tabChange('admin-pagetabs', '_shop_index');
+            admin.refresh();
+        });
+    });
+</script>
\ No newline at end of file
diff --git a/payapi/src/main/resources/templates/system/shop/updateshop.html b/payapi/src/main/resources/templates/system/shop/updateshop.html
new file mode 100644
index 0000000..da90dc3
--- /dev/null
+++ b/payapi/src/main/resources/templates/system/shop/updateshop.html
@@ -0,0 +1,333 @@
+<div class="layui-card">
+    <div class="layui-card-header">
+        <h2 class="header-title">修改商户</h2>
+        <span class="layui-breadcrumb pull-right">
+          <a href="#!_shop_index">商户管理</a>
+          <a><cite>修改商户</cite></a>
+        </span>
+    </div>
+    <div class="layui-card-body">
+        <div id="shop-update-info" class="layui-form toolbar" lay-filter="shop-update-info-form">
+            <div class="layui-card-header">商户基本信息</div>
+            <div class="layui-form-item" style="margin-left: 15px;margin-top: 15px;">
+                <label class="layui-form-label" style="color: red;width: 100px;"><span
+                        style="color: red;">*</span>商户类型</label>
+                <div class="layui-input-inline">
+                    <select name="shoptype" id="shop-update-shoptype" lay-filter="shop-update-shoptype-filter"
+                            lay-verify="required" disabled="disabled">
+                        <option value="root" th:selected="${shop.shoptype=='root'}">根节点</option>
+                        <option value="group" th:selected="${shop.shoptype=='group'}">商户组</option>
+                        <option value="normal" th:selected="${shop.shoptype=='normal'}">结算商户</option>
+                    </select>
+                </div>
+                <div class="layui-form-mid layui-word-aux">
+                    注意:商户组无商户账号,且能创建下级商户。结算商户是叶子商户,会创建商户账号。保存后无法修改!!!
+                </div>
+            </div>
+            <div class="layui-card-body">
+                <div class="layui-form-item">
+                    <div class="layui-inline">
+                        <label class="layui-form-label" style="width: 100px;">商户号</label>
+                        <div class="layui-input-inline">
+                            <input type="text" name="shopid" class="layui-input" style="background-color: #f1f1f1;"
+                                   id="shop-update-shopid" th:value="${shop.shopid}"
+                                   readonly="readonly"/>
+                            <input type="hidden" id="hidden-shop-update-fshopid" th:value="${shop.fshopid}"/>
+                        </div>
+                    </div>
+                    <div class="layui-inline">
+                        <label class="layui-form-label" style="width: 100px;">商户账号</label>
+                        <div class="layui-input-inline">
+                            <input type="text" name="shopaccno" autocomplete="off" style="background-color: #f1f1f1;"
+                                   class="layui-input" readonly="readonly" th:value="${shop.shopaccno}" />
+                        </div>
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <div class="layui-inline">
+                        <label class="layui-form-label" style="width: 100px;"><span
+                                style="color: red;">*</span>上级商户号</label>
+                        <div class="layui-input-inline">
+                            <input type="text" name="fshopid" id="shop-update-fshopid" lay-filter="shop-update-fshopid"
+                                   class="layui-input" autocomplete="off" placeholder="请选择"
+                                   lay-verify="required|number"/>
+                        </div>
+                    </div>
+                    <div class="layui-inline">
+                        <label class="layui-form-label" style="width: 100px;"><span
+                                style="color: red;">*</span>商户名</label>
+                        <div class="layui-input-inline">
+                            <input type="text" name="shopname" id="shop-update-shopname" autocomplete="off" th:value="${shop.shopname}"
+                                   class="layui-input" maxlength="30" lay-verify="required"/>
+                        </div>
+                    </div>
+                </div>
+            </div>
+            <div class="layui-card-header">商户营业信息</div>
+            <div class="layui-card-body">
+                <div class="layui-form-item" style="margin-left: 15px;margin-top: 15px;">
+                    <label class="layui-form-label" style="width: 90px;"><span
+                            style="color: red;">*</span>营业执照编号</label>
+                    <div class="layui-input-inline" style="width: 525px;">
+                        <input name="businessLicenseNo" id="shop-update-businessLicenseNo" class="layui-input"
+                               autocomplete="off" th:value="${shop.businessLicenseNo}" />
+                    </div>
+                </div>
+
+                <div class="layui-form-item" style="margin-left: 15px;">
+                    <label class="layui-form-label" style="width: 90px;"><span
+                            style="color: red;">*</span>税务登记证号</label>
+                    <div class="layui-input-inline" style="width: 525px;">
+                        <input name="taxRegistrationNo" id="shop-update-taxRegistrationNo" class="layui-input"
+                               autocomplete="off" th:value="${shop.taxRegistrationNo}" />
+                    </div>
+                </div>
+
+                <div class="layui-form-item" style="margin-left: 15px;">
+                    <label class="layui-form-label" style="width: 90px;"><span
+                            style="color: red;">*</span>商户经营地址</label>
+                    <div class="layui-input-inline" style="width: 525px;">
+                        <input name="addr" id="shop-update-addr" class="layui-input" autocomplete="off" th:value="${shop.addr}" />
+                    </div>
+                </div>
+
+                <div class="layui-form-item" style="margin-left: 15px;">
+                    <label class="layui-form-label" style="width: 90px;"><span style="color: red;">*</span>法人姓名</label>
+                    <div class="layui-input-inline" style="width: 525px;">
+                        <input name="legalPersonName" id="shop-update-legalPersonName" class="layui-input"
+                               autocomplete="off" th:value="${shop.legalPersonName}" />
+                    </div>
+                </div>
+
+                <div class="layui-form-item" style="margin-left: 15px;">
+                    <div class="layui-inline">
+                        <label class="layui-form-label" style="width: 90px;"><span
+                                style="color: red;">*</span>法人证件类型</label>
+                        <div class="layui-input-inline">
+                            <select name="legalPersonIdtype" id="shop-update-legalPersonIdtype" th:field="*{shop.legalPersonIdtype}"
+                                    lay-filter="shop-update-legalPersonIdtype-filter" class="layui-select">
+                                <option th:each="bean : ${idtypeList}" th:value="${bean.dictval}">[[${bean.dictcaption}]]</option>
+                            </select>
+                        </div>
+                    </div>
+                    <div class="layui-inline">
+                        <label class="layui-form-label" style="width: 90px;"><span
+                                style="color: red;">*</span>法人证件号</label>
+                        <div class="layui-input-inline">
+                            <input type="text" name="legalPersonIdno" id="shop-update-legalPersonIdno"
+                                   class="layui-input" th:value="${shop.legalPersonIdno}"
+                                   maxlength="20"
+                                   autocomplete="off"/>
+                        </div>
+                    </div>
+                </div>
+            </div>
+            <div class="layui-card-header">商户联系人信息</div>
+            <div class="layui-card-body">
+                <div class="layui-form-item">
+                    <div class="layui-inline">
+                        <label class="layui-form-label" style="width: 100px;">姓名</label>
+                        <div class="layui-input-inline">
+                            <input type="text" name="contactman" id="shop-update-contactman" class="layui-input"
+                                   autocomplete="off" th:value="${shop.contactman}" />
+                        </div>
+                    </div>
+                    <div class="layui-inline">
+                        <label class="layui-form-label" style="width: 100px;">手机号</label>
+                        <div class="layui-input-inline">
+                            <input type="text" name="mobile" id="shop-update-mobile" class="layui-input" maxlength="20"
+                                   autocomplete="off" th:value="${shop.mobile}"
+                                   lay-verify="mobile"/>
+                        </div>
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <div class="layui-inline">
+                        <label class="layui-form-label" style="width: 100px;">邮箱</label>
+                        <div class="layui-input-inline">
+                            <input type="text" name="email" class="layui-input" autocomplete="off"
+                                   id="shop-update-email" th:value="${shop.email}" />
+                        </div>
+                    </div>
+                    <div class="layui-inline">
+                        <label class="layui-form-label" style="width: 100px;">电话</label>
+                        <div class="layui-input-inline">
+                            <input type="text" name="tel" id="shop-update-tel" class="layui-input" maxlength="20"
+                                   autocomplete="off" th:value="${shop.tel}" />
+                        </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-update-btn-filter" lay-submit
+                        id="submitbtn-shop-update-btn">保存
+                </button>
+                <button class="layui-btn layui-btn-primary" type="button" id="submitbtn-shop-update-return-btn">返回
+                </button>
+            </div>
+        </div>
+    </div>
+</div>
+
+<script>
+    layui.use(['form', 'table', 'admin', 'jquery', 'element', 'treeSelect'], function () {
+        var form = layui.form;
+        var admin = layui.admin;
+        var $ = layui.jquery;
+        var element = layui.element;
+        var treeSelect = layui.treeSelect;
+
+        form.render("select");
+        form.verify({
+            "mobile": function (e) {
+                if (null != e && e.length > 0 && !(/^1\d{10}$/.test(e))) {
+                    return "请输入正确的手机号";
+                }
+            },
+            "swEmail": function (e) {
+                if (null != e && e.length > 0 && !(/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(e))) {
+                    return "邮箱格式不正确";
+                }
+            }
+        });
+
+        treeSelect.render({
+            elem: '#shop-update-fshopid',
+            data: '[[@{/shop/selectshopgroup}]]',
+            type: 'get',
+            placeholder: '请选择',
+            search: false,
+            style: {
+                folder: {
+                    enable: false
+                },
+                line: {
+                    enable: true
+                }
+            },
+            // 点击回调
+            click: function (d) {
+                var treeNode = d.current;
+                return true;
+            },
+            success: function (d) {
+                console.log(d); // 加载完成后的回调函数
+                var df = $("#hidden-shop-update-fshopid").val();
+                treeSelect.checkNode('shop-update-fshopid', df);
+            }
+        });
+
+
+
+        $("#submitbtn-shop-update-return-btn").click(function () {
+            element.tabDelete('admin-pagetabs', '_shop_manager_update'); //关闭现有详情
+            element.tabChange('admin-pagetabs', '_shop_index');
+            admin.refresh();
+        });
+
+        $("#submitbtn-shop-update-btn").click(function () {
+            var shopid = $("#shop-update-shopid").val();
+            var shoptype = $("#shop-update-shoptype").val();
+            var fshopid = $("#shop-update-fshopid").val();
+            var shopname = $("#shop-update-shopname").val();
+            var businessLicenseNo = $("#shop-update-businessLicenseNo").val();
+            var taxRegistrationNo = $("#shop-update-taxRegistrationNo").val();
+            var addr = $("#shop-update-addr").val();
+            var legalPersonName = $("#shop-update-legalPersonName").val();
+            var legalPersonIdtype = $("#shop-update-legalPersonIdtype").val();
+            var legalPersonIdno = $("#shop-update-legalPersonIdno").val();
+            var contactman = $("#shop-update-contactman").val();
+            var mobile = $("#shop-update-mobile").val();
+            var email = $("#shop-update-email").val();
+            var tel = $("#shop-update-tel").val();
+            var token = $("meta[name='_csrf_token']").attr("value");
+            if (isempty(shopid)) {
+                layer.msg("商户ID为空,请返回重新操作", {icon: 2, time: 1000});
+                $("#shop-update-shoptype").focus();
+                return;
+            }
+            if (isempty(fshopid)) {
+                layer.msg("请选择上级商户", {icon: 2, time: 1000});
+                $("#shop-update-fshopid").focus();
+                return;
+            }else if(shopid == fshopid){
+                layer.msg("上级商户不能是本身", {icon: 2, time: 1000});
+                $("#shop-update-fshopid").focus();
+                return;
+            }
+            if (isempty(shopname)) {
+                layer.msg("请填写商户名称", {icon: 2, time: 1000});
+                $("#shop-update-shopname").focus();
+                return;
+            }
+            if ("normal" == shoptype) {
+                if (isempty(businessLicenseNo)) {
+                    layer.msg("请填写商户营业执照编号", {icon: 2, time: 1000});
+                    $("#shop-update-businessLicenseNo").focus();
+                    return;
+                }
+                if (isempty(taxRegistrationNo)) {
+                    layer.msg("请填写商户税务登记证号", {icon: 2, time: 1000});
+                    $("#shop-update-taxRegistrationNo").focus();
+                    return;
+                }
+                if (isempty(addr)) {
+                    layer.msg("请填写商户经营地址", {icon: 2, time: 1000});
+                    $("#shop-update-addr").focus();
+                    return;
+                }
+                if (isempty(legalPersonName)) {
+                    layer.msg("请填写商户法人姓名", {icon: 2, time: 1000});
+                    $("#shop-update-legalPersonName").focus();
+                    return;
+                }
+                if (isempty(legalPersonIdtype)) {
+                    layer.msg("请选择法人证件类型", {icon: 2, time: 1000});
+                    $("#shop-update-legalPersonIdtype").focus();
+                    return;
+                }
+                if (isempty(legalPersonIdno)) {
+                    layer.msg("请填写法人证件号", {icon: 2, time: 1000});
+                    $("#shop-update-legalPersonIdno").focus();
+                    return;
+                }
+            }
+
+            layer.confirm("确定要保存吗?", function () {
+                admin.go('[[@{/shop/updateshop}]]', {
+                    shopid: shopid,
+                    fshopid: fshopid,
+                    shopname: shopname,
+                    businessLicenseNo: businessLicenseNo,
+                    taxRegistrationNo: taxRegistrationNo,
+                    addr: addr,
+                    legalPersonName: legalPersonName,
+                    legalPersonIdtype: legalPersonIdtype,
+                    legalPersonIdno: legalPersonIdno,
+                    contactman: contactman,
+                    mobile: mobile,
+                    email: email,
+                    tel: tel,
+                    _csrf: token
+                }, function (data) {
+                    if (data.code === 200) {
+                        layer.msg(data.msg, {icon: 1, time: 1000});
+                        element.tabDelete('admin-pagetabs', '_shop_manager_update'); //关闭现有详情
+                        element.tabChange('admin-pagetabs', '_shop_index');
+                        admin.refresh();
+                    } else if (data.code === 401) {
+                        layer.msg(data.msg, {icon: 2, time: 1500}, function () {
+                            location.replace('[[@{/login}]]');
+                        }, 1000);
+                    } else {
+                        layer.msg(data.msg, {icon: 2});
+                        return;
+                    }
+                }, function (err) {
+                    admin.errorBack(err);
+                });
+            });
+        });
+    });
+</script>
\ No newline at end of file
diff --git a/payapi/src/main/resources/templates/system/thirdchk/chkdtl.html b/payapi/src/main/resources/templates/system/thirdchk/chkdtl.html
index fbc2b4e..dba78cb 100644
--- a/payapi/src/main/resources/templates/system/thirdchk/chkdtl.html
+++ b/payapi/src/main/resources/templates/system/thirdchk/chkdtl.html
@@ -65,7 +65,7 @@
     layui.use(['form', 'table', 'admin'], function () {
         var form = layui.form;
         var table = layui.table;
-        var admin = layui.admin
+        var admin = layui.admin;
 
         form.render("select");
         form.render("checkbox");