商户营业情况表
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/VoucherDao.java b/src/main/java/com/supwisdom/dlpay/framework/dao/VoucherDao.java
index d8b831e..02f5bad 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/dao/VoucherDao.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/dao/VoucherDao.java
@@ -3,6 +3,7 @@
 import com.supwisdom.dlpay.framework.data.ExistBean;
 import com.supwisdom.dlpay.framework.data.MerchBean;
 import com.supwisdom.dlpay.framework.domain.TVoucher;
+import com.supwisdom.dlpay.system.bean.ShopBusinessInfo;
 import com.supwisdom.dlpay.system.bean.SubjectDetailShowBean;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Pageable;
@@ -11,10 +12,12 @@
 import org.springframework.data.jpa.repository.Modifying;
 import org.springframework.data.jpa.repository.Query;
 import org.springframework.data.repository.query.Param;
+import org.springframework.stereotype.Repository;
 
 import javax.persistence.LockModeType;
 import java.util.List;
 
+@Repository
 public interface VoucherDao extends JpaRepository<TVoucher, Integer> {
 
   @Query(value = "select count(t.voucherid) as existed from TB_VOUCHER t where t.POSTFLAG=0 ", nativeQuery = true)
@@ -45,4 +48,7 @@
       "from TVoucher a,TVoucherEntry b where a.voucherid=b.voucherid and a.postflag=1 and a.voucherdate>=:startdate and a.voucherdate<=:enddate and b.subjno=:subjno order by a.voucherdate,a.voucherno ",
       countQuery = "select count(a.voucherdate) from TVoucher a,TVoucherEntry b where a.voucherid=b.voucherid and a.postflag=1 and a.voucherdate>=:startdate and a.voucherdate<=:enddate and b.subjno=:subjno ")
   Page<SubjectDetailShowBean> getSubjectDetailInfos(@Param("startdate") Integer startdate, @Param("enddate") Integer enddate, @Param("subjno") String subjno, Pageable pageable);
+
+  @Query("select new com.supwisdom.dlpay.system.bean.ShopBusinessInfo(b.accno,b.summary,sum(a.transcnt),sum(b.dramt),sum(b.cramt)) from TVoucher a,TVoucherEntry b where a.voucherid=b.voucherid and a.postflag=1 and a.sourcetype<>'jiekuan' and b.subjno='2004' and a.voucherdate>=:startdate and a.voucherdate<=:enddate group by b.accno,b.summary ")
+  List<ShopBusinessInfo> getShopBusinessInfos(@Param("startdate") Integer startdate, @Param("enddate") Integer enddate);
 }
diff --git a/src/main/java/com/supwisdom/dlpay/framework/domain/TVoucher.java b/src/main/java/com/supwisdom/dlpay/framework/domain/TVoucher.java
index cd13743..b85e4e0 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/domain/TVoucher.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/domain/TVoucher.java
@@ -41,8 +41,8 @@
   @Column(name="ATTACHMENTS", precision = 1)
   private Integer attachments;
 
-  @Column(name="SOURCETYPE", length = 20)
-  private String sourcetype;
+  @Column(name="SOURCETYPE", nullable = false, length = 20)
+  private String sourcetype; //auto-自动生成;hand-手工凭证;jiekuan-解款凭证(商户营业额不会统计解款凭证)
 
   @Column(name="SIGNFLAG", precision = 1)
   private Integer signflag;
diff --git a/src/main/java/com/supwisdom/dlpay/system/bean/ShopBusinessInfo.java b/src/main/java/com/supwisdom/dlpay/system/bean/ShopBusinessInfo.java
new file mode 100644
index 0000000..f7c2434
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/system/bean/ShopBusinessInfo.java
@@ -0,0 +1,60 @@
+package com.supwisdom.dlpay.system.bean;
+
+public class ShopBusinessInfo {
+  private String shopaccno;
+  private String summary;
+  private Long transcnt;
+  private Double dramt;
+  private Double cramt;
+
+  public ShopBusinessInfo() {
+  }
+
+  public ShopBusinessInfo(String shopaccno, String summary, Long transcnt, Double dramt, Double cramt) {
+    this.shopaccno = shopaccno;
+    this.summary = summary;
+    this.transcnt = transcnt;
+    this.dramt = dramt;
+    this.cramt = cramt;
+  }
+
+  public String getShopaccno() {
+    return shopaccno;
+  }
+
+  public void setShopaccno(String shopaccno) {
+    this.shopaccno = shopaccno;
+  }
+
+  public String getSummary() {
+    return summary;
+  }
+
+  public void setSummary(String summary) {
+    this.summary = summary;
+  }
+
+  public Long getTranscnt() {
+    return transcnt;
+  }
+
+  public void setTranscnt(Long transcnt) {
+    this.transcnt = transcnt;
+  }
+
+  public Double getDramt() {
+    return dramt;
+  }
+
+  public void setDramt(Double dramt) {
+    this.dramt = dramt;
+  }
+
+  public Double getCramt() {
+    return cramt;
+  }
+
+  public void setCramt(Double cramt) {
+    this.cramt = cramt;
+  }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/system/bean/ShopBusinessShowBean.java b/src/main/java/com/supwisdom/dlpay/system/bean/ShopBusinessShowBean.java
new file mode 100644
index 0000000..0d793e1
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/system/bean/ShopBusinessShowBean.java
@@ -0,0 +1,67 @@
+package com.supwisdom.dlpay.system.bean;
+
+public class ShopBusinessShowBean {
+  private String shopid;
+  private String shopname;
+  private String fshopid;
+  private String shopaccno;
+  private String summary;
+  private Long transcnt;
+  private Double transamt;
+
+  public String getShopid() {
+    return shopid;
+  }
+
+  public void setShopid(String shopid) {
+    this.shopid = shopid;
+  }
+
+  public String getShopname() {
+    return shopname;
+  }
+
+  public void setShopname(String shopname) {
+    this.shopname = shopname;
+  }
+
+  public String getFshopid() {
+    return fshopid;
+  }
+
+  public void setFshopid(String fshopid) {
+    this.fshopid = fshopid;
+  }
+
+  public String getShopaccno() {
+    return shopaccno;
+  }
+
+  public void setShopaccno(String shopaccno) {
+    this.shopaccno = shopaccno;
+  }
+
+  public String getSummary() {
+    return summary;
+  }
+
+  public void setSummary(String summary) {
+    this.summary = summary;
+  }
+
+  public Long getTranscnt() {
+    return transcnt;
+  }
+
+  public void setTranscnt(Long transcnt) {
+    this.transcnt = transcnt;
+  }
+
+  public Double getTransamt() {
+    return transamt;
+  }
+
+  public void setTransamt(Double transamt) {
+    this.transamt = transamt;
+  }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/system/bean/TreeSelectNode.java b/src/main/java/com/supwisdom/dlpay/system/bean/TreeSelectNode.java
index 47ceff2..87b6fd2 100644
--- a/src/main/java/com/supwisdom/dlpay/system/bean/TreeSelectNode.java
+++ b/src/main/java/com/supwisdom/dlpay/system/bean/TreeSelectNode.java
@@ -9,6 +9,7 @@
   private boolean checked;
   private List<TreeSelectNode> children;
 
+  private String pId;   //扩展 父级ID
   private String accno; //扩展:商户账号
 
   public String getId() {
@@ -51,6 +52,14 @@
     this.children = children;
   }
 
+  public String getpId() {
+    return pId;
+  }
+
+  public void setpId(String pId) {
+    this.pId = pId;
+  }
+
   public String getAccno() {
     return accno;
   }
diff --git a/src/main/java/com/supwisdom/dlpay/system/controller/SettleReportController.java b/src/main/java/com/supwisdom/dlpay/system/controller/SettleReportController.java
index 71c00d9..c7cb46b 100644
--- a/src/main/java/com/supwisdom/dlpay/system/controller/SettleReportController.java
+++ b/src/main/java/com/supwisdom/dlpay/system/controller/SettleReportController.java
@@ -1,12 +1,11 @@
 package com.supwisdom.dlpay.system.controller;
 
 import com.supwisdom.dlpay.api.bean.BaseResp;
-import com.supwisdom.dlpay.api.bean.JsonResult;
-import com.supwisdom.dlpay.framework.domain.TSubject;
 import com.supwisdom.dlpay.framework.util.DateUtil;
 import com.supwisdom.dlpay.framework.util.PageResult;
 import com.supwisdom.dlpay.framework.util.StringUtil;
 import com.supwisdom.dlpay.framework.util.WebConstant;
+import com.supwisdom.dlpay.system.bean.ShopBusinessShowBean;
 import com.supwisdom.dlpay.system.bean.SubjectDayShowBean;
 import com.supwisdom.dlpay.system.bean.SubjectDetailShowBean;
 import com.supwisdom.dlpay.system.bean.TreeSelectNode;
@@ -19,6 +18,7 @@
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.ResponseBody;
 
+import java.util.Date;
 import java.util.List;
 
 @Controller
@@ -117,4 +117,43 @@
     return settleReportService.getSystemShowSubjectTree();
   }
 
+  /**
+   * ====================================================
+   * 商户营业情况表
+   * ====================================================
+   */
+  @GetMapping("/report/shopbusiness")
+  public String shopBusinessReport(ModelMap map) {
+    String settledate = settleReportService.getSystemSettledate();
+    map.addAttribute("maxdate", DateUtil.parseToDateFormat(DateUtil.getNewDay(settledate, -1)));
+    return "system/report/shopbusiness";
+  }
+
+  @GetMapping("/report/shopbusinesslist")
+  @PreAuthorize("hasPermission('/report/shopbusiness','')")
+  @ResponseBody
+  public PageResult<ShopBusinessShowBean> getShopbusinessData(@RequestParam(value = "startdate", required = false) String startdate,
+                                                              @RequestParam(value = "enddate", required = false) String enddate,
+                                                              @RequestParam(value = "shopid", required = false) String shopid,
+                                                              @RequestParam(value = "nodealshow", required = false, defaultValue = "false") Boolean noDealShow){
+    try {
+      BaseResp resp = new BaseResp();
+      if (!checkReportDate(startdate, enddate, resp)) {
+        return new PageResult<>(99, resp.getRetmsg());
+      }
+      return settleReportService.getShopBusinessShowInfos(DateUtil.unParseToDateFormat(startdate), DateUtil.unParseToDateFormat(enddate), shopid, noDealShow);
+    } catch (Exception e) {
+      e.printStackTrace();
+      return new PageResult<>(99, "系统查询异常");
+    }
+  }
+
+  @GetMapping("/report/selectshoptree")
+  @PreAuthorize("hasPermission('/report/shopbusiness','')")
+  @ResponseBody
+  public List<TreeSelectNode> searchShopTree() {
+    return settleReportService.getSystemNormalShopTree();
+  }
+
+
 }
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/SettleReportService.java b/src/main/java/com/supwisdom/dlpay/system/service/SettleReportService.java
index 7abff58..6b60bca 100644
--- a/src/main/java/com/supwisdom/dlpay/system/service/SettleReportService.java
+++ b/src/main/java/com/supwisdom/dlpay/system/service/SettleReportService.java
@@ -1,6 +1,7 @@
 package com.supwisdom.dlpay.system.service;
 
 import com.supwisdom.dlpay.framework.util.PageResult;
+import com.supwisdom.dlpay.system.bean.ShopBusinessShowBean;
 import com.supwisdom.dlpay.system.bean.SubjectDayShowBean;
 import com.supwisdom.dlpay.system.bean.SubjectDetailShowBean;
 import com.supwisdom.dlpay.system.bean.TreeSelectNode;
@@ -21,4 +22,10 @@
 
   @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
   List<TreeSelectNode> getSystemShowSubjectTree();
+
+  @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
+  List<TreeSelectNode> getSystemNormalShopTree();
+
+  @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
+  PageResult<ShopBusinessShowBean> getShopBusinessShowInfos(String startdate, String enddate, String shopid, boolean nodealshow);
 }
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/impl/SettleReportServiceImpl.java b/src/main/java/com/supwisdom/dlpay/system/service/impl/SettleReportServiceImpl.java
index 8bce060..dc1128f 100644
--- a/src/main/java/com/supwisdom/dlpay/system/service/impl/SettleReportServiceImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/system/service/impl/SettleReportServiceImpl.java
@@ -1,18 +1,14 @@
 package com.supwisdom.dlpay.system.service.impl;
 
-import com.supwisdom.dlpay.framework.dao.SettleCtlDao;
-import com.supwisdom.dlpay.framework.dao.SubjectDao;
-import com.supwisdom.dlpay.framework.dao.SubjectdayDao;
-import com.supwisdom.dlpay.framework.dao.VoucherDao;
+import com.supwisdom.dlpay.framework.dao.*;
 import com.supwisdom.dlpay.framework.domain.TSettlectl;
+import com.supwisdom.dlpay.framework.domain.TShop;
 import com.supwisdom.dlpay.framework.domain.TSubject;
 import com.supwisdom.dlpay.framework.util.DateUtil;
+import com.supwisdom.dlpay.framework.util.MoneyUtil;
 import com.supwisdom.dlpay.framework.util.PageResult;
 import com.supwisdom.dlpay.framework.util.StringUtil;
-import com.supwisdom.dlpay.system.bean.SubjectDayInfo;
-import com.supwisdom.dlpay.system.bean.SubjectDayShowBean;
-import com.supwisdom.dlpay.system.bean.SubjectDetailShowBean;
-import com.supwisdom.dlpay.system.bean.TreeSelectNode;
+import com.supwisdom.dlpay.system.bean.*;
 import com.supwisdom.dlpay.system.service.SettleReportService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
@@ -33,6 +29,8 @@
   private VoucherDao voucherDao;
   @Autowired
   private SubjectDao subjectDao;
+  @Autowired
+  private ShopDao shopDao;
 
   @Override
   public String getSystemSettledate() {
@@ -81,7 +79,7 @@
   @Override
   public PageResult<SubjectDetailShowBean> getSubjectDetailInfos(String startdate, String enddate, String subjno, int pageNo, int pageSize) {
     Pageable pageable = PageRequest.of(pageNo - 1, pageSize);
-    Page<SubjectDetailShowBean> page = voucherDao.getSubjectDetailInfos(Integer.valueOf(startdate),Integer.valueOf(enddate),subjno,pageable);
+    Page<SubjectDetailShowBean> page = voucherDao.getSubjectDetailInfos(Integer.valueOf(startdate), Integer.valueOf(enddate), subjno, pageable);
     return new PageResult<>(page);
   }
 
@@ -130,4 +128,125 @@
     }
     return result;
   }
+
+  @Override
+  public List<TreeSelectNode> getSystemNormalShopTree() {
+    List<TShop> shopList = shopDao.getNormalShops();
+    return getShopSelectTree(shopList, 0);
+  }
+
+  private List<TreeSelectNode> getShopSelectTree(List<TShop> shopList, int fshopid) {
+    List<TreeSelectNode> result = new ArrayList<>(0);
+    if (!StringUtil.isEmpty(shopList)) {
+      for (TShop shop : shopList) {
+        if (fshopid == shop.getFshopid()) {
+          TreeSelectNode node = new TreeSelectNode();
+          node.setId(shop.getShopid().toString());
+          node.setName(shop.getShopname());
+          node.setOpen(shop.getShoptype() == 0);
+          node.setChecked(false);
+          node.setAccno(shop.getShopaccno() == null ? "" : shop.getShopaccno());
+          node.setpId(String.valueOf(fshopid));
+          List<TreeSelectNode> children = getShopSelectTree(shopList, shop.getShopid());
+          node.setChildren(StringUtil.isEmpty(children) ? null : children);
+          result.add(node);
+        }
+      }
+    }
+    return result;
+  }
+
+  private List<TShop> getShopBusinessSelectShops(List<TShop> shopList, String shopid) {
+    if (StringUtil.isEmpty(shopid)) return shopList;
+
+    int select_shopid = Integer.parseInt(shopid); //单选
+    List<TShop> result = new ArrayList<>(0);
+    for (TShop shop : shopList) {
+      if (select_shopid == shop.getShopid()) {
+        result.add(shop);
+        break;
+      }
+    }
+    if (StringUtil.isEmpty(result)) return result; //shopid 不存在
+    result.addAll(getChildrenShopByShopid(shopList, select_shopid)); //子商户
+    return result;
+  }
+
+  private List<TShop> getChildrenShopByShopid(List<TShop> shopList, int fshopid) {
+    List<TShop> result = new ArrayList<>(0);
+    for (TShop shop : shopList) {
+      if (fshopid == shop.getFshopid()) {
+        result.add(shop);
+        result.addAll(getChildrenShopByShopid(shopList, shop.getShopid()));
+      }
+    }
+    return result;
+  }
+
+  @Override
+  public PageResult<ShopBusinessShowBean> getShopBusinessShowInfos(String startdate, String enddate, String shopid, boolean nodealshow) {
+    List<ShopBusinessInfo> businessInfos = voucherDao.getShopBusinessInfos(Integer.valueOf(startdate), Integer.valueOf(enddate));
+    if (StringUtil.isEmpty(businessInfos) && !nodealshow) {
+      return new PageResult<>(99, "无数据"); //无交易记录
+    }
+    List<TShop> shopAllList = shopDao.getNormalShops();
+    List<ShopBusinessShowBean> result = new ArrayList<>(0);
+    List<TShop> shopList = getShopBusinessSelectShops(shopAllList, shopid);
+    for (TShop shop : shopList) {
+      ShopBusinessShowBean bean = new ShopBusinessShowBean();
+      bean.setShopid(shop.getShopid().toString());
+      bean.setShopname(shop.getShopname());
+      bean.setFshopid(shop.getFshopid() == null ? "0" : shop.getFshopid().toString());
+      bean.setShopaccno(shop.getShopaccno() == null ? "" : shop.getShopaccno());
+      bean.setSummary("");
+      if (StringUtil.isEmpty(shop.getShopaccno())) {
+        //商户组,计算该组下所有的交易额
+        long transcnt = 0;
+        double transamt = 0;
+        List<TShop> childrenShops = getChildrenShopByShopid(shopAllList,shop.getShopid().intValue()); //子商户列表
+        for (TShop child : childrenShops) {
+          if(!StringUtil.isEmpty(child.getShopaccno())){
+            for(ShopBusinessInfo info:businessInfos){
+              if(child.getShopaccno().equals(info.getShopaccno())){
+                transcnt += info.getTranscnt();
+                transamt += (info.getCramt() - info.getDramt());
+              }
+            }
+          }
+        }
+        bean.setTranscnt(transcnt);
+        bean.setTransamt(MoneyUtil.formatYuan(transamt));
+      } else {
+        //末级商户
+        long transcnt = 0;
+        double transamt = 0;
+        for (ShopBusinessInfo info : businessInfos) {
+          if (shop.getShopaccno().equals(info.getShopaccno())) {
+            transcnt += info.getTranscnt();
+            transamt += (info.getCramt() - info.getDramt());
+
+            ShopBusinessShowBean temp = new ShopBusinessShowBean();
+            temp.setShopid(info.getShopaccno());
+            temp.setShopname("");
+            temp.setFshopid(shop.getShopid().toString());
+            temp.setShopaccno(info.getShopaccno());
+            temp.setSummary(info.getSummary());
+            temp.setTranscnt(info.getTranscnt());
+            temp.setTransamt(info.getCramt() - info.getDramt());
+            result.add(temp);
+          }
+        }
+
+        bean.setTranscnt(transcnt);
+        bean.setTransamt(MoneyUtil.formatYuan(transamt));
+      }
+
+      if (bean.getTranscnt() == 0 && MoneyUtil.moneyEqual(bean.getTransamt(), 0)) {
+        if (nodealshow) result.add(bean); //显示未交易商户
+      } else {
+        result.add(bean);
+      }
+    }
+    return new PageResult<>(result);
+  }
 }
diff --git a/src/main/resources/templates/system/report/shopbusiness.html b/src/main/resources/templates/system/report/shopbusiness.html
new file mode 100644
index 0000000..47ac319
--- /dev/null
+++ b/src/main/resources/templates/system/report/shopbusiness.html
@@ -0,0 +1,179 @@
+<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" lay-filter="shopbusiness-search-form">
+            <input type="hidden" id="shopbusiness-hidden-maxdate" th:value="${maxdate}" />
+            <input type="hidden" id="shopbusiness-hidden-parentId" value="0"/>
+            <div class="layui-form-item" style="margin-bottom: 0;">
+                <div class="layui-inline">
+                    <label class="layui-form-label">记账日期</label>
+                    <div class="layui-input-inline">
+                        <input type="text" name="startdate" id="shopbusiness-search-startdate" placeholder="起始日期" th:value="${maxdate}"
+                               autocomplete="off" class="layui-input"/>
+                    </div>
+                    <div class="layui-form-mid">-</div>
+                    <div class="layui-input-inline">
+                        <input type="text" name="enddate" id="shopbusiness-search-enddate" placeholder="截止日期" th:value="${maxdate}"
+                               autocomplete="off" class="layui-input"/>
+                    </div>
+                </div>
+
+                <div class="layui-inline">
+                    <label class="layui-form-label">选择商户</label>
+                    <div class="layui-input-block">
+                        <input type="text" name="shopid" id="shopbusiness-search-shopid" placeholder="选择商户" lay-filter="shopbusiness-search-shopid-filter"
+                               autocomplete="off" class="layui-input"/>
+                    </div>
+                </div>
+
+                <div class="layui-inline">
+                    <div class="layui-input-block" style="margin-left: 0;">
+                        <input type="checkbox" name="nodealshow" id="shopbusiness-search-nodealshow" lay-skin="primary" title="显示未交易商户"/>
+                    </div>
+                </div>
+
+                <div class="layui-inline">
+                    <button id="shopbusiness-search-btn" class="layui-btn icon-btn" data-type="search"><i
+                            class="layui-icon">&#xe615;</i>搜索
+                    </button>
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="layui-card-body">
+        <table class="layui-table" id="shopbusinessTable" lay-filter="shopbusinessTable-filter"></table>
+    </div>
+</div>
+
+<script type="text/html" id="shopbusiness-toolbar">
+    <div class="layui-btn-container">
+        <button class="layui-btn layui-btn-sm" id="btn-fold-shopbusiness" lay-event="shopbusinessShowFold">全部折叠</button>
+        <button class="layui-btn layui-btn-sm" id="btn-expand-shopbusiness" lay-event="shopbusinessExpandAll">全部展开</button>
+    </div>
+</script>
+
+
+<script>
+    layui.use(['form', 'table', 'layer', 'admin', 'element', 'laydate', 'treeSelect', 'treetable'], function () {
+        var form = layui.form;
+        var table = layui.table;
+        var admin = layui.admin;
+        var laydate = layui.laydate;
+        var treetable = layui.treetable;
+        var treeSelect = layui.treeSelect;
+
+        form.render("checkbox");
+        laydate.render({
+            elem: '#shopbusiness-search-startdate',
+            max: $("#shopbusiness-hidden-maxdate").val()
+        });
+        laydate.render({
+            elem: '#shopbusiness-search-enddate',
+            max: $("#shopbusiness-hidden-maxdate").val()
+        });
+
+        treeSelect.render({
+            elem: '#shopbusiness-search-shopid',
+            data: '/report/selectshoptree',
+            type: 'get',
+            placeholder: '选择商户',
+            search: false,
+            style: {
+                folder: {
+                    enable: false
+                },
+                line: {
+                    enable: true
+                }
+            },
+            // 点击回调
+            click: function (d) {
+                var treeNode = d.current;
+                console.log(treeNode);
+                $("#shopbusiness-hidden-parentId").val(treeNode.pId);
+                return true;
+            },
+            success: function (d) {
+                console.log(d); // 加载完成后的回调函数
+            }
+        });
+
+        var renderTable = function (obj) {
+            layer.load(2);
+            var parentId = $("#shopbusiness-hidden-parentId").val();
+            console.log(parentId);
+            treetable.render({
+                id: 'ShopBusinessReport',
+                title: '商户营业情况表',
+                treeColIndex: 0,
+                treeSpid: parentId,
+                treeIdName: 'shopid',
+                treePidName: 'fshopid',
+                treeDefaultClose: false,
+                treeLinkage: false,
+                elem: '#shopbusinessTable',
+                url: '/report/shopbusinesslist',
+                page: false,
+                where: obj,
+                showicon: false,
+                toolbar:'#shopbusiness-toolbar',
+                cols: [
+                    [
+                        {field: 'shopname', title: '商户名称', align: 'left'},
+                        {field: 'summary', title: '交易摘要', align: 'center'},
+                        {field: 'transcnt', title: '交易次数', align: 'center'},
+                        {field: 'transamt', title: '交易金额', align: 'center'}
+                    ]
+                ],
+                done: function (res, curr, count) {
+                    console.log(res);
+                    layer.closeAll('loading');
+                }
+            });
+        }
+        renderTable({
+            startdate: $("#shopbusiness-search-startdate").val(),
+            enddate: $("#shopbusiness-search-enddate").val(),
+            shopid: "",
+            nodealshow: false
+        });
+
+        $('#shopbusiness-search-btn').click(function () {
+            var startdate = $("#shopbusiness-search-startdate").val();
+            var enddate = $("#shopbusiness-search-enddate").val();
+            var shopid = $("#shopbusiness-search-shopid").val();
+            var nodealshow = $("#shopbusiness-search-nodealshow").is(':checked');
+            if (null == startdate || "" == $.trim(startdate)) {
+                layer.msg('请选择起始日期', {icon: 2, time: 1500});
+                return;
+            }
+            if (null == enddate || "" == $.trim(enddate)) {
+                layer.msg('请选择截止日期', {icon: 2, time: 1500});
+                return;
+            }
+            renderTable({
+                startdate: startdate,
+                enddate: enddate,
+                shopid: shopid,
+                nodealshow: nodealshow
+            });
+        });
+
+        table.on('toolbar(shopbusinessTable-filter)', function(obj){
+            switch(obj.event){
+                case 'shopbusinessShowFold':
+                    treetable.foldAll('#shopbusinessTable');
+                    break;
+                case 'shopbusinessExpandAll':
+                    treetable.expandAll('#shopbusinessTable');
+                    break;
+            }
+        });
+    });
+</script>
\ No newline at end of file
diff --git a/src/main/resources/templates/system/report/subjectday.html b/src/main/resources/templates/system/report/subjectday.html
index 43acfa0..f376baf 100644
--- a/src/main/resources/templates/system/report/subjectday.html
+++ b/src/main/resources/templates/system/report/subjectday.html
@@ -96,7 +96,7 @@
                                 if (d.subjlevel == 1) {
                                     return '<span>' + d.subjname + '</span>';
                                 } else {
-                                    return '<span>&nbsp;&nbsp;&nbsp;&nbsp;' + d.subjname + '</span>';
+                                    return '<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' + d.subjname + '</span>';
                                 }
 
                             }