权限分配增加,银行流水报表增加
diff --git a/sql/view.sql b/sql/view.sql
new file mode 100644
index 0000000..34c3df8
--- /dev/null
+++ b/sql/view.sql
@@ -0,0 +1,12 @@
+ create or replace view v_transdtl as
+ SELECT t.transdate,t.transtime,t.billno,'' AS tradeno,'' AS authno,t.custname,c.bankcardno,d.rulename,
+t1.deptname,t.termid,s.shopname,'' AS searchno,t.amount,'' AS serviceamt,t.transtype,
+t.status,'T+1' AS cleartype,'普通' AS servicetype,0 AS revertamt,t.revbillno,
+substr((t.revbillno), 0, 9) AS revtransdate FROM ((((tb_transdtl t
+ JOIN tb_card c ON (((t.cardno) = (c.cardno))))
+ JOIN tb_discount_rule d ON ((t.ruleid = d.ruleid)))
+ JOIN ( SELECT c_1.custid,
+        p.deptname
+FROM (tb_customer c_1
+JOIN tb_dept p ON (((c_1.deptcode) = (p.deptcode))))) t1 ON (((t.custid) = (t1.custid))))
+ JOIN tb_shopsettlement s ON (((t.shopid) = (s.shopid))));
\ No newline at end of file
diff --git a/src/main/java/com/supwisdom/dlpay/framework/dao/OperatorQueryLimitDao.java b/src/main/java/com/supwisdom/dlpay/framework/dao/OperatorQueryLimitDao.java
new file mode 100644
index 0000000..93da8a4
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/framework/dao/OperatorQueryLimitDao.java
@@ -0,0 +1,10 @@
+package com.supwisdom.dlpay.framework.dao;
+
+import com.supwisdom.dlpay.system.domain.TOperatorQueryLimit;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface OperatorQueryLimitDao extends JpaRepository<TOperatorQueryLimit, String> {
+    TOperatorQueryLimit findByOpercode(String opercode);
+}
diff --git a/src/main/java/com/supwisdom/dlpay/framework/service/impl/OperatorDetailServiceImpl.java b/src/main/java/com/supwisdom/dlpay/framework/service/impl/OperatorDetailServiceImpl.java
index 3619998..38fdcc9 100644
--- a/src/main/java/com/supwisdom/dlpay/framework/service/impl/OperatorDetailServiceImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/framework/service/impl/OperatorDetailServiceImpl.java
@@ -2,6 +2,7 @@
 
 import com.supwisdom.dlpay.framework.dao.OperRoleDao;
 import com.supwisdom.dlpay.framework.dao.OperatorDao;
+import com.supwisdom.dlpay.framework.dao.OperatorQueryLimitDao;
 import com.supwisdom.dlpay.framework.domain.TOperator;
 import com.supwisdom.dlpay.framework.service.OperatorDetailService;
 import com.supwisdom.dlpay.framework.util.StringUtil;
@@ -20,6 +21,7 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
+import java.util.Optional;
 
 @Service
 public class OperatorDetailServiceImpl implements OperatorDetailService {
@@ -28,6 +30,8 @@
   @Autowired
   private OperRoleDao operRoleDao;
   @Autowired
+  private OperatorQueryLimitDao operatorQueryLimitDao;
+  @Autowired
   private MultiTenantService multiTenantService;
 
   @Override
@@ -64,4 +68,6 @@
     oper.setAuthorities(authorities);
     return oper;
   }
+
+
 }
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/bean/TermReportSearchBean.java b/src/main/java/com/supwisdom/dlpay/restaurant/bean/TermReportSearchBean.java
new file mode 100644
index 0000000..27df945
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/bean/TermReportSearchBean.java
@@ -0,0 +1,62 @@
+package com.supwisdom.dlpay.restaurant.bean;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class TermReportSearchBean {
+  private Integer ruleid;
+  private String shopid;
+  private String shopname;
+  private String startdate;
+  private String enddate;
+  private Integer devgroupid;
+
+  public Integer getRuleid() {
+    return ruleid;
+  }
+
+  public void setRuleid(Integer ruleid) {
+    this.ruleid = ruleid;
+  }
+
+  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 getStartdate() {
+    return startdate;
+  }
+
+  public void setStartdate(String startdate) {
+    this.startdate = startdate;
+  }
+
+  public String getEnddate() {
+    return enddate;
+  }
+
+  public void setEnddate(String enddate) {
+    this.enddate = enddate;
+  }
+
+
+  public Integer getDevgroupid() {
+    return devgroupid;
+  }
+
+  public void setDevgroupid(Integer devgroupid) {
+    this.devgroupid = devgroupid;
+  }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/bean/TermReportShowBean.java b/src/main/java/com/supwisdom/dlpay/restaurant/bean/TermReportShowBean.java
new file mode 100644
index 0000000..d94958f
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/bean/TermReportShowBean.java
@@ -0,0 +1,173 @@
+package com.supwisdom.dlpay.restaurant.bean;
+
+
+public class TermReportShowBean {
+    private Integer termid;
+
+    //普通
+    private Double b_normalamt; //早餐
+    private Integer b_normalcnt;//早餐
+    private Double l_normalamt; //午餐
+    private Integer l_normalcnt;//午餐
+    private Double d_normalamt; //晚餐
+    private Integer d_normalcnt;//晚餐
+
+    //折扣
+    private Double b_discountamt; //早餐
+    private Integer b_discountcnt;//早餐
+    private Double l_discountamt; //午餐
+    private Integer l_discountcnt;//午餐
+    private Double d_discountamt; //晚餐
+    private Integer d_discountcnt;//晚餐
+
+    private Integer totdiscountcnt;//折扣总数
+    private Double totdiscountamt;//折扣总金额
+    private Double totfeetamt;//折扣金额
+
+    private Integer totnormalcnt;//普通总数
+    private Double totnormalamt;//普通总金额
+
+    public Integer getTermid() {
+        return termid;
+    }
+
+    public void setTermid(Integer termid) {
+        this.termid = termid;
+    }
+
+    public Double getB_normalamt() {
+        return b_normalamt;
+    }
+
+    public void setB_normalamt(Double b_normalamt) {
+        this.b_normalamt = b_normalamt;
+    }
+
+    public Integer getB_normalcnt() {
+        return b_normalcnt;
+    }
+
+    public void setB_normalcnt(Integer b_normalcnt) {
+        this.b_normalcnt = b_normalcnt;
+    }
+
+    public Double getL_normalamt() {
+        return l_normalamt;
+    }
+
+    public void setL_normalamt(Double l_normalamt) {
+        this.l_normalamt = l_normalamt;
+    }
+
+    public Integer getL_normalcnt() {
+        return l_normalcnt;
+    }
+
+    public void setL_normalcnt(Integer l_normalcnt) {
+        this.l_normalcnt = l_normalcnt;
+    }
+
+    public Double getD_normalamt() {
+        return d_normalamt;
+    }
+
+    public void setD_normalamt(Double d_normalamt) {
+        this.d_normalamt = d_normalamt;
+    }
+
+    public Integer getD_normalcnt() {
+        return d_normalcnt;
+    }
+
+    public void setD_normalcnt(Integer d_normalcnt) {
+        this.d_normalcnt = d_normalcnt;
+    }
+
+    public Double getB_discountamt() {
+        return b_discountamt;
+    }
+
+    public void setB_discountamt(Double b_discountamt) {
+        this.b_discountamt = b_discountamt;
+    }
+
+    public Integer getB_discountcnt() {
+        return b_discountcnt;
+    }
+
+    public void setB_discountcnt(Integer b_discountcnt) {
+        this.b_discountcnt = b_discountcnt;
+    }
+
+    public Double getL_discountamt() {
+        return l_discountamt;
+    }
+
+    public void setL_discountamt(Double l_discountamt) {
+        this.l_discountamt = l_discountamt;
+    }
+
+    public Integer getL_discountcnt() {
+        return l_discountcnt;
+    }
+
+    public void setL_discountcnt(Integer l_discountcnt) {
+        this.l_discountcnt = l_discountcnt;
+    }
+
+    public Double getD_discountamt() {
+        return d_discountamt;
+    }
+
+    public void setD_discountamt(Double d_discountamt) {
+        this.d_discountamt = d_discountamt;
+    }
+
+    public Integer getD_discountcnt() {
+        return d_discountcnt;
+    }
+
+    public void setD_discountcnt(Integer d_discountcnt) {
+        this.d_discountcnt = d_discountcnt;
+    }
+
+    public Integer getTotdiscountcnt() {
+        return totdiscountcnt;
+    }
+
+    public void setTotdiscountcnt(Integer totdiscountcnt) {
+        this.totdiscountcnt = totdiscountcnt;
+    }
+
+    public Double getTotdiscountamt() {
+        return totdiscountamt;
+    }
+
+    public void setTotdiscountamt(Double totdiscountamt) {
+        this.totdiscountamt = totdiscountamt;
+    }
+
+    public Double getTotfeetamt() {
+        return totfeetamt;
+    }
+
+    public void setTotfeetamt(Double totfeetamt) {
+        this.totfeetamt = totfeetamt;
+    }
+
+    public Integer getTotnormalcnt() {
+        return totnormalcnt;
+    }
+
+    public void setTotnormalcnt(Integer totnormalcnt) {
+        this.totnormalcnt = totnormalcnt;
+    }
+
+    public Double getTotnormalamt() {
+        return totnormalamt;
+    }
+
+    public void setTotnormalamt(Double totnormalamt) {
+        this.totnormalamt = totnormalamt;
+    }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/bean/TransDtlSearchBean.java b/src/main/java/com/supwisdom/dlpay/restaurant/bean/TransDtlSearchBean.java
index 4f63744..c113c6e 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/bean/TransDtlSearchBean.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/bean/TransDtlSearchBean.java
@@ -12,6 +12,7 @@
     private String status;
     private String shopid;
     private String accdate;
+    private String opercode;
 
     public String getAccdate() {
         return accdate;
@@ -77,16 +78,11 @@
         this.shopid = shopid;
     }
 
-    @Override
-    public String toString() {
-        return "TransDtlSearchBean+++++{" +
-                "billno='" + billno + '\'' +
-                ", custname='" + custname + '\'' +
-                ", startdate='" + startdate + '\'' +
-                ", enddate='" + enddate + '\'' +
-                ", termid=" + termid +
-                ", status=" + status +
-                ", shopid=" + shopid +
-                '}';
+    public String getOpercode() {
+        return opercode;
+    }
+
+    public void setOpercode(String opercode) {
+        this.opercode = opercode;
     }
 }
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/bean/VTransDtl.java b/src/main/java/com/supwisdom/dlpay/restaurant/bean/VTransDtl.java
new file mode 100644
index 0000000..9aad264
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/bean/VTransDtl.java
@@ -0,0 +1,230 @@
+package com.supwisdom.dlpay.restaurant.bean;
+
+public class VTransDtl {
+
+  private String billno;
+  private String custname;
+  private String authno;
+  private String tradeno;
+  private Double amount;
+  private String transdate;
+  private String transtime;
+  private String deptname;
+  private Integer termid;
+  private String status;
+  private Integer revflag;
+  private String transtype;
+  private String rulename;
+  private String shopid;
+  private String shopname;
+  private String revbillno;
+  private Integer revertamt;
+  private String cleartype;
+  private String servicetype;
+  private String searchno;
+  private String transmode;
+  private Integer custtype;
+  private String revtransdate;
+  private String bankcardno;
+  private String serviceamt;
+
+  public String getBillno() {
+    return billno;
+  }
+
+  public void setBillno(String billno) {
+    this.billno = billno;
+  }
+
+  public String getCustname() {
+    return custname;
+  }
+
+  public void setCustname(String custname) {
+    this.custname = custname;
+  }
+
+  public String getAuthno() {
+    return authno;
+  }
+
+  public void setAuthno(String authno) {
+    this.authno = authno;
+  }
+
+  public String getTradeno() {
+    return tradeno;
+  }
+
+  public void setTradeno(String tradeno) {
+    this.tradeno = tradeno;
+  }
+
+  public Double getAmount() {
+    return amount;
+  }
+
+  public String getShopid() {
+    return shopid;
+  }
+
+  public void setShopid(String shopid) {
+    this.shopid = shopid;
+  }
+
+  public String getRulename() {
+    return rulename;
+  }
+
+  public void setRulename(String rulename) {
+    this.rulename = rulename;
+  }
+
+  public void setAmount(Double amount) {
+    this.amount = amount;
+  }
+
+  public String getTransdate() {
+    return transdate;
+  }
+
+  public void setTransdate(String transdate) {
+    this.transdate = transdate;
+  }
+
+  public String getTranstime() {
+    return transtime;
+  }
+
+  public void setTranstime(String transtime) {
+    this.transtime = transtime;
+  }
+
+  public String getServiceamt() {
+    return serviceamt;
+  }
+
+  public void setServiceamt(String serviceamt) {
+    this.serviceamt = serviceamt;
+  }
+
+  public String getDeptname() {
+    return deptname;
+  }
+
+  public void setDeptname(String deptname) {
+    this.deptname = deptname;
+  }
+
+  public Integer getTermid() {
+    return termid;
+  }
+
+  public void setTermid(Integer termid) {
+    this.termid = termid;
+  }
+
+  public String getStatus() {
+    return status;
+  }
+
+  public void setStatus(String status) {
+    this.status = status;
+  }
+
+  public Integer getRevflag() {
+    return revflag;
+  }
+
+  public void setRevflag(Integer revflag) {
+    this.revflag = revflag;
+  }
+
+  public String getTranstype() {
+    return transtype;
+  }
+
+  public void setTranstype(String transtype) {
+    this.transtype = transtype;
+  }
+
+  public String getShopname() {
+    return shopname;
+  }
+
+  public void setShopname(String shopname) {
+    this.shopname = shopname;
+  }
+
+  public String getRevbillno() {
+    return revbillno;
+  }
+
+  public void setRevbillno(String revbillno) {
+    this.revbillno = revbillno;
+  }
+
+  public Integer getRevertamt() {
+    return revertamt;
+  }
+
+  public void setRevertamt(Integer revertamt) {
+    this.revertamt = revertamt;
+  }
+
+  public String getCleartype() {
+    return cleartype;
+  }
+
+  public void setCleartype(String cleartype) {
+    this.cleartype = cleartype;
+  }
+
+  public String getServicetype() {
+    return servicetype;
+  }
+
+  public void setServicetype(String servicetype) {
+    this.servicetype = servicetype;
+  }
+
+  public String getSearchno() {
+    return searchno;
+  }
+
+  public void setSearchno(String searchno) {
+    this.searchno = searchno;
+  }
+
+  public String getTransmode() {
+    return transmode;
+  }
+
+  public void setTransmode(String transmode) {
+    this.transmode = transmode;
+  }
+
+  public Integer getCusttype() {
+    return custtype;
+  }
+
+  public void setCusttype(Integer custtype) {
+    this.custtype = custtype;
+  }
+
+  public String getRevtransdate() {
+    return revtransdate;
+  }
+
+  public void setRevtransdate(String revtransdate) {
+    this.revtransdate = revtransdate;
+  }
+
+  public String getBankcardno() {
+    return bankcardno;
+  }
+
+  public void setBankcardno(String bankcardno) {
+    this.bankcardno = bankcardno;
+  }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/controller/CusttypeReportController.java b/src/main/java/com/supwisdom/dlpay/restaurant/controller/CusttypeReportController.java
index 2018868..5216c49 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/controller/CusttypeReportController.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/controller/CusttypeReportController.java
@@ -8,6 +8,8 @@
 import com.supwisdom.dlpay.restaurant.bean.DailyReportSearchBean;
 import com.supwisdom.dlpay.restaurant.service.CusttypeReportService;
 import com.supwisdom.dlpay.restaurant.service.StatementReportService;
+import com.supwisdom.dlpay.system.domain.TOperatorQueryLimit;
+import com.supwisdom.dlpay.system.service.OperatorService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.core.annotation.AuthenticationPrincipal;
 import org.springframework.security.core.userdetails.UserDetails;
@@ -32,8 +34,9 @@
     private CusttypeReportService custtypeReportService;
     @Autowired
     private StatementReportService statementReportService;
+    @Autowired
+    private OperatorService operatorService;
 
-    //TODO
     @RequestMapping("/index")
     public String indexView(
             @ModelAttribute("searchBean") DailyReportSearchBean searchBean,
@@ -43,11 +46,16 @@
         String maxdate = DateUtil.reformatDatetime(settledate, "yyyyMMdd", "yyyy-MM-dd");
         searchBean.setStartdate(settledate);
         searchBean.setEnddate(settledate);
-        model.addAttribute("showlist", custtypeReportService.getCusttypeReportSearchData(searchBean));
+        TOperator oper = (TOperator) operUser;
+        TOperatorQueryLimit limit=operatorService.getOperatorQueryLimit(oper.getOpercode());
+        if(null!=limit){
+            model.addAttribute("devgroupid",limit.getDevgroupid());
+            searchBean.setGroupid(limit.getDevgroupid());
+        }
 
+        model.addAttribute("showlist", custtypeReportService.getCusttypeReportSearchData(searchBean));
         model.addAttribute("maxdate", maxdate);
 
-        TOperator oper = (TOperator) operUser;
         model.addAttribute("opercode", oper == null ? "unknow" : oper.getOpercode());
 
         return "restaurant/custtypereport/index";
@@ -63,7 +71,10 @@
 
             TOperator oper = (TOperator) operUser;
             map.addAttribute("opercode", oper == null ? "unknow" : oper.getOpercode());
-
+            TOperatorQueryLimit limit=operatorService.getOperatorQueryLimit(oper.getOpercode());
+            if(null!=limit){
+                searchBean.setGroupid(limit.getDevgroupid());
+            }
             List<CusttypeReportShowBean> bean = custtypeReportService.getCusttypeReportSearchData(searchBean);
 
             map.addAttribute("showlist",bean);
@@ -79,8 +90,13 @@
                                     @AuthenticationPrincipal UserDetails operUser,
                                     HttpServletRequest request, HttpServletResponse response, ModelMap map){
         try {
-            List<CusttypeReportShowBean> datalist = custtypeReportService.getCusttypeReportSearchData(searchBean);
             TOperator oper = (TOperator) operUser;
+            TOperatorQueryLimit limit=operatorService.getOperatorQueryLimit(oper.getOpercode());
+            if(null!=limit){
+                searchBean.setGroupid(limit.getDevgroupid());
+            }
+            List<CusttypeReportShowBean> datalist = custtypeReportService.getCusttypeReportSearchData(searchBean);
+
             String filename="客户类别消费报表";
             custtypeReportService.doCreateCusttypeReportExcel(response, datalist, searchBean, filename, oper);
         } catch (Exception e) {
@@ -96,6 +112,10 @@
             map.addAttribute("showlist", custtypeReportService.getCusttypeReportSearchData(searchBean));
 
             TOperator oper = statementReportService.getOperatorByOpercode(opercode);
+            TOperatorQueryLimit limit=operatorService.getOperatorQueryLimit(oper.getOpercode());
+            if(null!=limit){
+                searchBean.setGroupid(limit.getDevgroupid());
+            }
             map.addAttribute("opername", oper == null ? "unknow" : oper.getOpername());
             map.addAttribute("period", custtypeReportService.getCusttypeReportSearchPeriod(searchBean));
             map.addAttribute("printdatetime",DateUtil.reformatDatetime(systemUtilService.getSysdatetime().getHostdatetime(),DateUtil.DATETIME_FMT,"yyyy-MM-dd HH:mm:ss"));
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/controller/StatementReportController.java b/src/main/java/com/supwisdom/dlpay/restaurant/controller/StatementReportController.java
index bc4b48b..01a4ca3 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/controller/StatementReportController.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/controller/StatementReportController.java
@@ -12,6 +12,8 @@
 import com.supwisdom.dlpay.restaurant.service.StatementReportService;
 
 import com.supwisdom.dlpay.restaurant.util.RestaurantConstant;
+import com.supwisdom.dlpay.system.domain.TOperatorQueryLimit;
+import com.supwisdom.dlpay.system.service.OperatorService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.security.core.annotation.AuthenticationPrincipal;
@@ -31,6 +33,8 @@
   private StatementReportService statementReportService;
   @Autowired
   private SystemUtilService systemUtilService;
+  @Autowired
+  private OperatorService operatorService;
 
   @GetMapping("/laborfee")
   public String LaborfeeIndex(@ModelAttribute("searchBean") LaborfeeSearchBean searchBean,
@@ -47,9 +51,16 @@
       searchBean.setEnddate(statdate);
       searchBean.setDatetype("days");
       searchBean.setYearmonth(maxmonth);
+      TOperator oper = (TOperator) operUser;
+      TOperatorQueryLimit limit=operatorService.getOperatorQueryLimit(oper.getOpercode());
+      if(null!=limit){
+        map.addAttribute("devgroupid",limit.getDevgroupid());
+        searchBean.setGroupid(limit.getDevgroupid());
+      }
+
       map.addAttribute("showlist", statementReportService.getLaborfeeSearchData(searchBean));
 
-      TOperator oper = (TOperator) operUser;
+
       map.addAttribute("opercode", oper == null ? "unknow" : oper.getOpercode());
 
     } catch (Exception e) {
@@ -66,6 +77,11 @@
                                ModelMap map) {
     try {
       TOperator oper = (TOperator) operUser;
+      TOperatorQueryLimit limit=operatorService.getOperatorQueryLimit(oper.getOpercode());
+      if(null!=limit){
+        map.addAttribute("devgroupid",limit.getDevgroupid());
+        searchBean.setGroupid(limit.getDevgroupid());
+      }
       map.addAttribute("opercode", oper == null ? "unknow" : oper.getOpercode());
 
       map.addAttribute("showlist", statementReportService.getLaborfeeSearchData(searchBean));
@@ -82,7 +98,12 @@
                                   HttpServletRequest request, HttpServletResponse response, ModelMap map){
     try {
       List<LaborfeeShowBean> datalist = statementReportService.getLaborfeeSearchData(searchBean);
+
       TOperator oper = (TOperator) operUser;
+      TOperatorQueryLimit limit=operatorService.getOperatorQueryLimit(oper.getOpercode());
+      if(null!=limit){
+        searchBean.setGroupid(limit.getDevgroupid());
+      }
       String filename="商户劳务费报表";
       statementReportService.doCreateLaborfeeExcel(response, datalist, searchBean, filename, oper);
     } catch (Exception e) {
@@ -100,6 +121,10 @@
       map.addAttribute("showlist", statementReportService.getLaborfeeSearchData(searchBean));
 
       TOperator oper = statementReportService.getOperatorByOpercode(opercode);
+      TOperatorQueryLimit limit=operatorService.getOperatorQueryLimit(oper.getOpercode());
+      if(null!=limit){
+        searchBean.setGroupid(limit.getDevgroupid());
+      }
       map.addAttribute("opername", oper == null ? "unknow" : oper.getOpername());
       map.addAttribute("period", statementReportService.getLaborfeeSearchPeriod(searchBean));
       map.addAttribute("printdatetime",DateUtil.reformatDatetime(systemUtilService.getSysdatetime().getHostdatetime(),DateUtil.DATETIME_FMT,"yyyy-MM-dd HH:mm:ss"));
@@ -126,9 +151,15 @@
       searchBean.setEnddate(statdate);
       searchBean.setDatetype("days");
       searchBean.setYearmonth(maxmonth);
+      TOperator oper = (TOperator) operUser;
+      TOperatorQueryLimit limit=operatorService.getOperatorQueryLimit(oper.getOpercode());
+      if(null!=limit){
+        map.addAttribute("devgroupid",limit.getDevgroupid());
+        searchBean.setGroupid(limit.getDevgroupid());
+      }
       map.addAttribute("showlist", statementReportService.getLaborCountSearchData(searchBean));
 
-      TOperator oper = (TOperator) operUser;
+
       map.addAttribute("opercode", oper == null ? "unknow" : oper.getOpercode());
     } catch (Exception e) {
       e.printStackTrace();
@@ -145,7 +176,10 @@
     try {
       TOperator oper = (TOperator) operUser;
       map.addAttribute("opercode", oper == null ? "unknow" : oper.getOpercode());
-
+      TOperatorQueryLimit limit=operatorService.getOperatorQueryLimit(oper.getOpercode());
+      if(null!=limit){
+        searchBean.setGroupid(limit.getDevgroupid());
+      }
       map.addAttribute("showlist", statementReportService.getLaborCountSearchData(searchBean));
     } catch (Exception e) {
       e.printStackTrace();
@@ -162,6 +196,10 @@
       List<LaborCountShowBean> datalist = statementReportService.getLaborCountSearchData(searchBean);
       TOperator oper = (TOperator) operUser;
       String filename="商户劳务费人次统计表";
+      TOperatorQueryLimit limit=operatorService.getOperatorQueryLimit(oper.getOpercode());
+      if(null!=limit){
+        searchBean.setGroupid(limit.getDevgroupid());
+      }
       statementReportService.doCreateLaborCountExcel(response, datalist, searchBean, filename, oper);
     } catch (Exception e) {
       e.printStackTrace();
@@ -175,6 +213,10 @@
       map.addAttribute("showlist", statementReportService.getLaborCountSearchData(searchBean));
 
       TOperator oper = statementReportService.getOperatorByOpercode(opercode);
+      TOperatorQueryLimit limit=operatorService.getOperatorQueryLimit(oper.getOpercode());
+      if(null!=limit){
+        searchBean.setGroupid(limit.getDevgroupid());
+      }
       map.addAttribute("opername", oper == null ? "unknow" : oper.getOpername());
       map.addAttribute("period", statementReportService.getLaborfeeSearchPeriod(searchBean));
       map.addAttribute("printdatetime",DateUtil.reformatDatetime(systemUtilService.getSysdatetime().getHostdatetime(),DateUtil.DATETIME_FMT,"yyyy-MM-dd HH:mm:ss"));
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/controller/TermReportController.java b/src/main/java/com/supwisdom/dlpay/restaurant/controller/TermReportController.java
new file mode 100644
index 0000000..0513687
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/controller/TermReportController.java
@@ -0,0 +1,126 @@
+package com.supwisdom.dlpay.restaurant.controller;
+
+
+import com.supwisdom.dlpay.framework.domain.TOperator;
+import com.supwisdom.dlpay.framework.service.SystemUtilService;
+import com.supwisdom.dlpay.framework.util.DateUtil;
+import com.supwisdom.dlpay.restaurant.bean.DailyReportSearchBean;
+import com.supwisdom.dlpay.restaurant.bean.TermReportSearchBean;
+import com.supwisdom.dlpay.restaurant.bean.TermReportShowBean;
+import com.supwisdom.dlpay.restaurant.service.TermReportService;
+import com.supwisdom.dlpay.restaurant.service.StatementReportService;
+import com.supwisdom.dlpay.system.domain.TOperatorQueryLimit;
+import com.supwisdom.dlpay.system.service.OperatorService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.core.annotation.AuthenticationPrincipal;
+import org.springframework.security.core.userdetails.UserDetails;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+@Controller
+@RequestMapping("/termreport")
+public class TermReportController {
+
+    @Autowired
+    private SystemUtilService systemUtilService;
+    @Autowired
+    private TermReportService termReportService;
+    @Autowired
+    private StatementReportService statementReportService;
+    @Autowired
+    private OperatorService operatorService;
+
+    @RequestMapping("/index")
+    public String indexView(
+            @ModelAttribute("searchBean") TermReportSearchBean searchBean,
+            @AuthenticationPrincipal UserDetails operUser,
+            ModelMap model) {
+        String settledate = statementReportService.getMaxStatementDate();
+        String maxdate = DateUtil.reformatDatetime(settledate, "yyyyMMdd", "yyyy-MM-dd");
+        searchBean.setStartdate(settledate);
+        searchBean.setEnddate(settledate);
+        TOperator oper = (TOperator) operUser;
+        TOperatorQueryLimit limit=operatorService.getOperatorQueryLimit(oper.getOpercode());
+        if(null!=limit){
+            model.addAttribute("devgroupid",limit.getDevgroupid());
+            searchBean.setDevgroupid(limit.getDevgroupid());
+        }
+        model.addAttribute("showlist", termReportService.getTermReportSearchData(searchBean));
+        model.addAttribute("maxdate", maxdate);
+        model.addAttribute("opercode", oper == null ? "unknow" : oper.getOpercode());
+
+        return "restaurant/termreport/index";
+    }
+
+    @RequestMapping("/termreportlist")
+    public String getDataList(
+            @ModelAttribute("searchBean") TermReportSearchBean searchBean,
+            @AuthenticationPrincipal UserDetails operUser,
+            ModelMap map) {
+        try {
+
+            TOperator oper = (TOperator) operUser;
+            map.addAttribute("opercode", oper == null ? "unknow" : oper.getOpercode());
+            TOperatorQueryLimit limit=operatorService.getOperatorQueryLimit(oper.getOpercode());
+            if(null!=limit){
+                searchBean.setDevgroupid(limit.getDevgroupid());
+            }
+            List<TermReportShowBean> bean = termReportService.getTermReportSearchData(searchBean);
+
+            map.addAttribute("showlist",bean);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return "restaurant/termreport/index::termreportTable";
+    }
+
+    @GetMapping("/excelexport")
+    public void excelExport(@ModelAttribute("searchBean") TermReportSearchBean searchBean,
+                            @AuthenticationPrincipal UserDetails operUser,
+                            HttpServletRequest request, HttpServletResponse response, ModelMap map){
+        try {
+            TOperator oper = (TOperator) operUser;
+            TOperatorQueryLimit limit=operatorService.getOperatorQueryLimit(oper.getOpercode());
+            if(null!=limit){
+                searchBean.setDevgroupid(limit.getDevgroupid());
+            }
+            List<TermReportShowBean> datalist = termReportService.getTermReportSearchData(searchBean);
+            String filename="客户类别消费报表";
+            termReportService.doCreateTermReportExcel(response, datalist, searchBean, filename, oper);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+
+    @GetMapping("/print/printtermreport")
+    public String print(@ModelAttribute("searchBean") TermReportSearchBean searchBean,
+                        @RequestParam(value = "opercode",required = false) String opercode, ModelMap map) {
+        try {
+            TOperatorQueryLimit limit=operatorService.getOperatorQueryLimit(opercode);
+            if(null!=limit){
+                searchBean.setDevgroupid(limit.getDevgroupid());
+            }
+            map.addAttribute("showlist", termReportService.getTermReportSearchData(searchBean));
+
+            TOperator oper = statementReportService.getOperatorByOpercode(opercode);
+            map.addAttribute("opername", oper == null ? "unknow" : oper.getOpername());
+            map.addAttribute("period", termReportService.getTermReportSearchPeriod(searchBean));
+            map.addAttribute("printdatetime",DateUtil.reformatDatetime(systemUtilService.getSysdatetime().getHostdatetime(),DateUtil.DATETIME_FMT,"yyyy-MM-dd HH:mm:ss"));
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return "restaurant/termreport/print/printtermreport";
+    }
+
+
+}
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/controller/TransCountReportController.java b/src/main/java/com/supwisdom/dlpay/restaurant/controller/TransCountReportController.java
index 36a2900..e060f94 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/controller/TransCountReportController.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/controller/TransCountReportController.java
@@ -8,6 +8,8 @@
 import com.supwisdom.dlpay.restaurant.bean.TransCountShowBean;
 import com.supwisdom.dlpay.restaurant.service.StatementReportService;
 import com.supwisdom.dlpay.restaurant.service.TransCountReportService;
+import com.supwisdom.dlpay.system.domain.TOperatorQueryLimit;
+import com.supwisdom.dlpay.system.service.OperatorService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.core.annotation.AuthenticationPrincipal;
 import org.springframework.security.core.userdetails.UserDetails;
@@ -32,6 +34,8 @@
     private TransCountReportService transCountReportService;
     @Autowired
     private StatementReportService statementReportService;
+    @Autowired
+    private OperatorService operatorService;
 
     @RequestMapping("/index")
     public String indexView(
@@ -42,11 +46,16 @@
         String maxdate = DateUtil.reformatDatetime(settledate, "yyyyMMdd", "yyyy-MM-dd");
         searchBean.setStartdate(settledate);
         searchBean.setEnddate(settledate);
+        TOperator oper = (TOperator) operUser;
+        TOperatorQueryLimit limit=operatorService.getOperatorQueryLimit(oper.getOpercode());
+        if(null!=limit){
+            model.addAttribute("devgroupid",limit.getDevgroupid());
+        }
+        searchBean.setGroupid(limit.getDevgroupid());
         model.addAttribute("showlist", transCountReportService.getTransCountReportSearchData(searchBean));
 
         model.addAttribute("maxdate", maxdate);
 
-        TOperator oper = (TOperator) operUser;
         model.addAttribute("opercode", oper == null ? "unknow" : oper.getOpercode());
 
         return "restaurant/transcountreport/index";
@@ -64,7 +73,10 @@
             map.addAttribute("opercode", oper == null ? "unknow" : oper.getOpercode());
 
             List<TransCountShowBean> bean = transCountReportService.getTransCountReportSearchData(searchBean);
-
+            TOperatorQueryLimit limit=operatorService.getOperatorQueryLimit(oper.getOpercode());
+            if(null!=limit){
+                searchBean.setGroupid(limit.getDevgroupid());
+            }
             map.addAttribute("showlist",bean);
 
         } catch (Exception e) {
@@ -81,6 +93,10 @@
             List<TransCountShowBean> bean = transCountReportService.getTransCountReportSearchData(searchBean);
             TOperator oper = (TOperator) operUser;
             String filename="人员消费报表";
+            TOperatorQueryLimit limit=operatorService.getOperatorQueryLimit(oper.getOpercode());
+            if(null!=limit){
+                searchBean.setGroupid(limit.getDevgroupid());
+            }
             transCountReportService.doCreateTransCountReportExcel(response, bean, searchBean, filename, oper);
         } catch (Exception e) {
             e.printStackTrace();
@@ -95,6 +111,10 @@
             map.addAttribute("showlist", transCountReportService.getTransCountReportSearchData(searchBean));
 
             TOperator oper = statementReportService.getOperatorByOpercode(opercode);
+            TOperatorQueryLimit limit=operatorService.getOperatorQueryLimit(oper.getOpercode());
+            if(null!=limit){
+                searchBean.setGroupid(limit.getDevgroupid());
+            }
             map.addAttribute("opername", oper == null ? "unknow" : oper.getOpername());
             map.addAttribute("period", transCountReportService.getTransCountReportSearchPeriod(searchBean));
             map.addAttribute("printdatetime",DateUtil.reformatDatetime(systemUtilService.getSysdatetime().getHostdatetime(),DateUtil.DATETIME_FMT,"yyyy-MM-dd HH:mm:ss"));
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/controller/TransDtlController.java b/src/main/java/com/supwisdom/dlpay/restaurant/controller/TransDtlController.java
index 51a607c..070a261 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/controller/TransDtlController.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/controller/TransDtlController.java
@@ -3,13 +3,17 @@
 
 import com.google.gson.Gson;
 import com.supwisdom.dlpay.api.bean.JsonResult;
+import com.supwisdom.dlpay.framework.domain.TOperator;
 import com.supwisdom.dlpay.framework.domain.TShopSettlement;
 import com.supwisdom.dlpay.framework.util.*;
 import com.supwisdom.dlpay.restaurant.bean.TransDtlSearchBean;
+import com.supwisdom.dlpay.restaurant.bean.VTransDtl;
 import com.supwisdom.dlpay.restaurant.domain.TTransDtl;
 import com.supwisdom.dlpay.restaurant.service.ShopSettlementService;
 import com.supwisdom.dlpay.restaurant.service.TransDtlService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.core.annotation.AuthenticationPrincipal;
+import org.springframework.security.core.userdetails.UserDetails;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.ModelMap;
 import org.springframework.web.bind.annotation.*;
@@ -30,7 +34,7 @@
     private ShopSettlementService shopSettlementService;
 
     @RequestMapping("/index")
-    public String indexView(ModelMap model) {
+    public String index (ModelMap model) {
         List<TShopSettlement> lst = shopSettlementService.getAllShopSettlement();
         Map<String, String> map = new HashMap<>();
         for (TShopSettlement shop : lst) {
@@ -48,6 +52,27 @@
         return "restaurant/transdtl/index";
     }
 
+
+    @RequestMapping("/indexview")
+    public String indexForView(ModelMap model) {
+        List<TShopSettlement> lst = shopSettlementService.getAllShopSettlement();
+        Map<String, String> map = new HashMap<>();
+        for (TShopSettlement shop : lst) {
+            map.put(shop.getShopid(), shop.getShopname());
+        }
+        String startDate = DateUtil.getNewDay(-7, "yyyy-MM-dd");
+        String endDate = DateUtil.getNow("yyyy-MM-dd");
+
+        Gson gson = new Gson();
+        String gsonString = gson.toJson(map);
+        model.addAttribute("shoplistForSelect", lst);
+        model.addAttribute("shopList", gsonString);
+        model.addAttribute("startDate", startDate);
+        model.addAttribute("endDate", endDate);
+        return "restaurant/transdtl/indexview";
+    }
+
+
     @RequestMapping("/list")
     @ResponseBody
     public PageResult<TTransDtl> getDataList(@RequestParam("page") Integer pageNo,
@@ -58,11 +83,15 @@
                                              @RequestParam(value = "enddate", required = false) String enddate,
                                              @RequestParam(value = "billno", required = false) String billno,
                                              @RequestParam(value = "status", required = false) String status,
-                                             @RequestParam(value = "termid", required = false) Integer termid) {
+                                             @RequestParam(value = "termid", required = false) Integer termid,
+                                             @AuthenticationPrincipal UserDetails operUser) {
         try {
             if (null == pageNo || pageNo < 1) pageNo = WebConstant.PAGENO_DEFAULT;
             if (null == pageSize || pageSize < 1) pageSize = WebConstant.PAGESIZE_DEFAULT;
+
             TransDtlSearchBean bean = getTransDtlSearchBean(custname, shopid, startdate, enddate, billno, status, termid);
+            TOperator operator=(TOperator)operUser;
+            bean.setOpercode(operator.getOpercode());
             bean.setPageNo(pageNo);
             bean.setPageSize(pageSize);
 
@@ -73,6 +102,34 @@
         }
     }
 
+    @RequestMapping("/listview")
+    @ResponseBody
+    public PageResult<VTransDtl> getDataListForView(@RequestParam("page") Integer pageNo,
+                                             @RequestParam("limit") Integer pageSize,
+                                             @RequestParam(value = "custname", required = false) String custname,
+                                             @RequestParam(value = "shopid", required = false) String shopid,
+                                             @RequestParam(value = "startdate", required = false) String startdate,
+                                             @RequestParam(value = "enddate", required = false) String enddate,
+                                             @RequestParam(value = "billno", required = false) String billno,
+                                             @RequestParam(value = "status", required = false) String status,
+                                             @RequestParam(value = "termid", required = false) Integer termid,
+                                             @AuthenticationPrincipal UserDetails operUser) {
+        try {
+            if (null == pageNo || pageNo < 1) pageNo = WebConstant.PAGENO_DEFAULT;
+            if (null == pageSize || pageSize < 1) pageSize = WebConstant.PAGESIZE_DEFAULT;
+
+            TransDtlSearchBean bean = getTransDtlSearchBean(custname, shopid, startdate, enddate, billno, status, termid);
+            TOperator operator=(TOperator)operUser;
+            bean.setOpercode(operator.getOpercode());
+            bean.setPageNo(pageNo);
+            bean.setPageSize(pageSize);
+
+            return transDtlService.getVTransdtlByParam(bean);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return new PageResult<>(99, "系统查询错误");
+        }
+    }
     @RequestMapping("/export")
     @ResponseBody
     public JsonResult downloadfile(@RequestParam(value = "custname", required = false) String custname,
@@ -82,12 +139,33 @@
                                    @RequestParam(value = "billno", required = false) String billno,
                                    @RequestParam(value = "status", required = false) String status,
                                    @RequestParam(value = "termid", required = false) Integer termid,
-                                   HttpServletRequest request, HttpServletResponse response) {
+                                   HttpServletRequest request, HttpServletResponse response,
+                                   @AuthenticationPrincipal UserDetails operUser) {
+
 
         TransDtlSearchBean bean = getTransDtlSearchBean(custname, shopid, startdate, enddate, billno, status, termid);
-        System.out.println(bean.toString());
+        TOperator operator=(TOperator)operUser;
+        bean.setOpercode(operator.getOpercode());
         return transDtlService.export(bean, request, response);
     }
+    @RequestMapping("/exportview")
+    @ResponseBody
+    public JsonResult downloadfileForView(@RequestParam(value = "custname", required = false) String custname,
+                                   @RequestParam(value = "shopid", required = false) String shopid,
+                                   @RequestParam(value = "startdate", required = false) String startdate,
+                                   @RequestParam(value = "enddate", required = false) String enddate,
+                                   @RequestParam(value = "billno", required = false) String billno,
+                                   @RequestParam(value = "status", required = false) String status,
+                                   @RequestParam(value = "termid", required = false) Integer termid,
+                                   HttpServletRequest request, HttpServletResponse response,
+                                   @AuthenticationPrincipal UserDetails operUser) {
+
+
+        TransDtlSearchBean bean = getTransDtlSearchBean(custname, shopid, startdate, enddate, billno, status, termid);
+        TOperator operator=(TOperator)operUser;
+        bean.setOpercode(operator.getOpercode());
+        return transDtlService.exportForView(bean, request, response);
+    }
 
     private TransDtlSearchBean getTransDtlSearchBean( String custname,  String shopid, String startdate, String enddate, String billno,String status, Integer termid) {
         TransDtlSearchBean bean = new TransDtlSearchBean();
@@ -96,6 +174,7 @@
         bean.setBillno(billno);
         bean.setStatus(status);
         bean.setShopid(shopid);
+
         if (StringUtil.isEmpty(startdate) || StringUtil.isEmpty(enddate)) {
             bean.setStartdate(DateUtil.getNewDay(-7, "yyyyMMdd"));
             bean.setEnddate(DateUtil.getNow("yyyyMMdd"));
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/controller/WhitelistController.java b/src/main/java/com/supwisdom/dlpay/restaurant/controller/WhitelistController.java
index 4cc73c7..2ec1d62 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/controller/WhitelistController.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/controller/WhitelistController.java
@@ -12,6 +12,8 @@
 import com.supwisdom.dlpay.restaurant.service.WhitelistService;
 import com.supwisdom.dlpay.restaurant.service.DeviceParamService;
 import com.supwisdom.dlpay.system.bean.TreeSelectNode;
+import com.supwisdom.dlpay.system.domain.TOperatorQueryLimit;
+import com.supwisdom.dlpay.system.service.OperatorService;
 import com.supwisdom.dlpay.system.service.ParamService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -35,6 +37,8 @@
     private WhitelistService whitelistService;
     @Autowired
     private DeviceParamService deviceParamService;
+    @Autowired
+    private OperatorService operatorService;
 
 
     @GetMapping("/whitelist/index")
@@ -320,8 +324,16 @@
 
     @GetMapping("/whitelistbind/devgrouptree")
     @ResponseBody
-    public List<TreeSelectNode> searchDevgroupTree() {
-        List<TreeSelectNode> tree = deviceParamService.getDeviceGroupSelectTree();
+    public List<TreeSelectNode> searchDevgroupTree( @AuthenticationPrincipal UserDetails operUser) {
+        TOperator operator=(TOperator)operUser;
+        TOperatorQueryLimit limit=operatorService.getOperatorQueryLimit(operator.getOpercode());
+        List<TreeSelectNode> tree;
+        if(null!=limit){
+            tree = deviceParamService.getDeviceGroupSelectTree(limit.getDevgroupid());
+        }else{
+            tree = deviceParamService.getDeviceGroupSelectTree( );
+        }
+
         return tree;
     }
 
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/dao/DeviceDao.java b/src/main/java/com/supwisdom/dlpay/restaurant/dao/DeviceDao.java
index 067df28..fe82f95 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/dao/DeviceDao.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/dao/DeviceDao.java
@@ -32,6 +32,8 @@
 
     TDevice findByDevicename(String devicename);
 
+    @Query(value="select t.id from Tb_Device t where t.devgroupid =:id and t.state=1", nativeQuery = true)
+    List<Integer> getIdByDevgroupid(@Param("id")Integer deviceid);
 
     TDevice findTDeviceById(Integer id);
 
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/dao/DeviceGroupDao.java b/src/main/java/com/supwisdom/dlpay/restaurant/dao/DeviceGroupDao.java
index 64d5678..b8fbe60 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/dao/DeviceGroupDao.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/dao/DeviceGroupDao.java
@@ -20,6 +20,8 @@
 
     List<TDeviceGroup> findByGrouptype(String grouptype);
 
+    List<TDeviceGroup> findByDevgroupid(Integer devgroupid);
+
     @Query(value = "select distinct devgroupid from tb_devicegroup where devgroupid=?1 or pid=?1",nativeQuery = true)
     List<Integer> findGroupidByDevgroupid(Integer groupid);
     @Query(value = "select distinct devgroupid from tb_devicegroup where grouptype='leaf'",nativeQuery = true)
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/domain/TOperDeviceGroupBind.java b/src/main/java/com/supwisdom/dlpay/restaurant/domain/TOperDeviceGroupBind.java
deleted file mode 100644
index a4ce747..0000000
--- a/src/main/java/com/supwisdom/dlpay/restaurant/domain/TOperDeviceGroupBind.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.supwisdom.dlpay.restaurant.domain;
-
-import org.hibernate.annotations.GenericGenerator;
-
-import javax.persistence.*;
-
-@Entity
-@Table(name = "TB_Oper_DeviceGroup_Bind")
-@SequenceGenerator(name="SEQ_AREA",sequenceName="SEQ_AREA",allocationSize=1)
-public class TOperDeviceGroupBind {
-
-    @Id
-    @GenericGenerator(name = "idGenerator", strategy = "uuid")
-    @GeneratedValue(generator = "idGenerator")
-    @Column(name = "bid", nullable = false, length = 32)
-    private String bid;
-    @Column(name = "OPERID", nullable = false, length = 32)
-    private String operid;
-    @Column(name = "devgroupid", nullable = false, length = 8)
-    private Integer devgroupid;
-
-
-    public String getBid() {
-        return bid;
-    }
-
-    public void setBid(String bid) {
-        this.bid = bid;
-    }
-
-    public String getOperid() {
-        return operid;
-    }
-
-    public void setOperid(String operid) {
-        this.operid = operid;
-    }
-
-    public Integer getDevgroupid() {
-        return devgroupid;
-    }
-
-    public void setDevgroupid(Integer devgroupid) {
-        this.devgroupid = devgroupid;
-    }
-}
\ No newline at end of file
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/service/DeviceParamService.java b/src/main/java/com/supwisdom/dlpay/restaurant/service/DeviceParamService.java
index 7a3c16f..6dd560d 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/service/DeviceParamService.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/service/DeviceParamService.java
@@ -55,6 +55,9 @@
   List<TreeSelectNode> getDeviceGroupSelectTree();
 
   @Transactional(rollbackFor = Exception.class, readOnly = true)
+  List<TreeSelectNode> getDeviceGroupSelectTree(Integer groupid);
+
+  @Transactional(rollbackFor = Exception.class, readOnly = true)
   List<TreeSelectNode> getDeviceGroupSelectBranchTree();
 
   @Transactional(rollbackFor = Exception.class)
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/service/TermReportService.java b/src/main/java/com/supwisdom/dlpay/restaurant/service/TermReportService.java
new file mode 100644
index 0000000..b9657be
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/service/TermReportService.java
@@ -0,0 +1,26 @@
+package com.supwisdom.dlpay.restaurant.service;
+
+import com.supwisdom.dlpay.framework.domain.TOperator;
+import com.supwisdom.dlpay.restaurant.bean.CusttypeReportShowBean;
+import com.supwisdom.dlpay.restaurant.bean.DailyReportSearchBean;
+import com.supwisdom.dlpay.restaurant.bean.TermReportSearchBean;
+import com.supwisdom.dlpay.restaurant.bean.TermReportShowBean;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+public interface TermReportService {
+
+
+    @Transactional(rollbackFor = Exception.class,readOnly = true)
+    List<TermReportShowBean> getTermReportSearchData(TermReportSearchBean searchBean);
+
+    @Transactional(rollbackFor = Exception.class,readOnly = true)
+    String getTermReportSearchPeriod(TermReportSearchBean searchBean);
+
+    @Transactional(rollbackFor = Exception.class,readOnly = true)
+    void doCreateTermReportExcel(HttpServletResponse response, List<TermReportShowBean> datalist, TermReportSearchBean searchBean, String filename, TOperator oper);
+
+
+}
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/service/TransDtlService.java b/src/main/java/com/supwisdom/dlpay/restaurant/service/TransDtlService.java
index af06e93..8160d4d 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/service/TransDtlService.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/service/TransDtlService.java
@@ -5,6 +5,7 @@
 import com.supwisdom.dlpay.restaurant.bean.ManageFeeAmtBean;
 import com.supwisdom.dlpay.restaurant.bean.SalesAmtBean;
 import com.supwisdom.dlpay.restaurant.bean.TransDtlSearchBean;
+import com.supwisdom.dlpay.restaurant.bean.VTransDtl;
 import com.supwisdom.dlpay.restaurant.domain.TTransDtl;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
@@ -19,8 +20,13 @@
     @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class,readOnly = true)
     PageResult<TTransDtl> getTransDtlByParam(TransDtlSearchBean param);
 
+    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class,readOnly = true)
+    PageResult<VTransDtl> getVTransdtlByParam(TransDtlSearchBean param);
+
     JsonResult export(TransDtlSearchBean bean, HttpServletRequest request, HttpServletResponse response);
 
+    JsonResult exportForView(TransDtlSearchBean bean, HttpServletRequest request, HttpServletResponse response);
+
     @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
     TTransDtl saveTransdtl(TTransDtl dtl);
 
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/CheckTransdtlServiceImpl.java b/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/CheckTransdtlServiceImpl.java
index 9d9adf0..587867e 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/CheckTransdtlServiceImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/CheckTransdtlServiceImpl.java
@@ -249,6 +249,7 @@
     }
 
     if (TradeDict.DTL_STATUS_SUCCESS.equals(transDtl.getStatus())) {
+      transDtl.setAccdate(detail.getAccdate());
       transDtl.setCoreStatus(TradeDict.DTL_STATUS_SUCCESS);
       transDtl.setCoreAccdate(detail.getAccdate());
       transDtl.setCoreSourcetype(detail.getOtherSourcetype());
@@ -313,11 +314,11 @@
   public TCheckDetail doRepairCheckDetail(TCheckDetail detail) {
     TTransDtl transDtl = transDtlDao.getByBillnoWithLock(detail.getLocalRefno());
     if (!RestaurantConstant.STATUS_TRANSDTL_SUCCESS.equals(transDtl.getStatus())) {
-      transDtl.setAccdate(detail.getAccdate());
-      transDtl.setAcctime(systemUtilService.getSysdatetime().getHosttime());
+     transDtl.setAcctime(systemUtilService.getSysdatetime().getHosttime());
       transDtl.setStatus(RestaurantConstant.STATUS_TRANSDTL_SUCCESS); //流水置为成功
       transDtl.setRefno(detail.getOtherRefno());
     }
+    transDtl.setAccdate(detail.getAccdate());
     transDtl.setCoreAccdate(detail.getAccdate());
     transDtl.setCoreSourcetype(detail.getOtherSourcetype());
     transDtl.setCoreStatus(RestaurantConstant.STATUS_TRANSDTL_SUCCESS);
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/CustomerServiceImpl.java b/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/CustomerServiceImpl.java
index dd1e83d..9c2914e 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/CustomerServiceImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/CustomerServiceImpl.java
@@ -3,18 +3,22 @@
 import com.supwisdom.dlpay.api.bean.JsonResult;
 import com.supwisdom.dlpay.framework.service.SystemUtilService;
 import com.supwisdom.dlpay.framework.util.*;
-import com.supwisdom.dlpay.restaurant.bean.*;
-import com.supwisdom.dlpay.restaurant.dao.*;
+import com.supwisdom.dlpay.restaurant.bean.CustomerExportBean;
+import com.supwisdom.dlpay.restaurant.bean.CustomerSaveBean;
+import com.supwisdom.dlpay.restaurant.bean.CustomerSearchBean;
+import com.supwisdom.dlpay.restaurant.bean.CustomerShowBean;
+import com.supwisdom.dlpay.restaurant.dao.CardDao;
+import com.supwisdom.dlpay.restaurant.dao.CardverDao;
+import com.supwisdom.dlpay.restaurant.dao.CustomerDao;
+import com.supwisdom.dlpay.restaurant.dao.DiscountDetailDao;
 import com.supwisdom.dlpay.restaurant.domain.TCard;
 import com.supwisdom.dlpay.restaurant.domain.TCardver;
 import com.supwisdom.dlpay.restaurant.domain.TCustomer;
 import com.supwisdom.dlpay.restaurant.domain.TDept;
-import com.supwisdom.dlpay.restaurant.service.CardService;
 import com.supwisdom.dlpay.restaurant.service.CustomerService;
 import com.supwisdom.dlpay.restaurant.service.DeptService;
 import com.supwisdom.dlpay.restaurant.util.DataUtil;
 import com.supwisdom.dlpay.restaurant.util.RestaurantConstant;
-import com.supwisdom.dlpay.system.bean.ZTreeNode;
 import org.apache.commons.lang3.StringUtils;
 import org.hibernate.query.internal.NativeQueryImpl;
 import org.hibernate.transform.Transformers;
@@ -29,7 +33,9 @@
 import javax.servlet.http.HttpServletResponse;
 import java.io.InputStream;
 import java.math.BigInteger;
-import java.util.*;
+import java.util.List;
+import java.util.Locale;
+import java.util.Optional;
 
 
 @Service
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/DeviceParamServiceImpl.java b/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/DeviceParamServiceImpl.java
index a37eb65..a6f136c 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/DeviceParamServiceImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/DeviceParamServiceImpl.java
@@ -1,6 +1,7 @@
 package com.supwisdom.dlpay.restaurant.service.impl;
 
 import com.supwisdom.dlpay.exception.WebCheckException;
+import com.supwisdom.dlpay.framework.dao.OperatorQueryLimitDao;
 import com.supwisdom.dlpay.framework.service.SystemUtilService;
 import com.supwisdom.dlpay.framework.util.PageResult;
 import com.supwisdom.dlpay.framework.util.StringUtil;
@@ -11,6 +12,7 @@
 import com.supwisdom.dlpay.restaurant.service.DeviceParamService;
 import com.supwisdom.dlpay.restaurant.util.RestaurantConstant;
 import com.supwisdom.dlpay.system.bean.TreeSelectNode;
+import com.supwisdom.dlpay.system.domain.TOperatorQueryLimit;
 import org.apache.commons.lang3.StringUtils;
 import org.hibernate.query.internal.NativeQueryImpl;
 import org.hibernate.transform.Transformers;
@@ -267,6 +269,13 @@
     }
 
     @Override
+    public List<TreeSelectNode> getDeviceGroupSelectTree(Integer groupid) {
+        List<TDeviceGroup> groupList = deviceGroupDao.findByDevgroupid(groupid);
+        if (StringUtil.isEmpty(groupList)) return new ArrayList<>(0);
+        return getDevgroupTree(groupList, 0);
+    }
+
+    @Override
     public List<TreeSelectNode> getDeviceGroupSelectBranchTree() {
         List<TDeviceGroup> groupList = deviceGroupDao.findByGrouptype(RestaurantConstant.DEVICEGROUP_TYPE_BRANCH);
         if (StringUtil.isEmpty(groupList)) return new ArrayList<>(0);
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/TermReportServiceImpl.java b/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/TermReportServiceImpl.java
new file mode 100644
index 0000000..88476b5
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/TermReportServiceImpl.java
@@ -0,0 +1,279 @@
+package com.supwisdom.dlpay.restaurant.service.impl;
+
+import com.supwisdom.dlpay.framework.domain.TOperator;
+import com.supwisdom.dlpay.framework.service.SystemUtilService;
+import com.supwisdom.dlpay.framework.util.DateUtil;
+import com.supwisdom.dlpay.framework.util.MoneyUtil;
+import com.supwisdom.dlpay.framework.util.StringUtil;
+import com.supwisdom.dlpay.restaurant.bean.TermReportShowBean;
+import com.supwisdom.dlpay.restaurant.bean.TermReportSearchBean;
+import com.supwisdom.dlpay.restaurant.service.TermReportService;
+import com.supwisdom.dlpay.restaurant.service.TermReportService;
+import com.supwisdom.dlpay.restaurant.util.ExcelPoiUtil;
+import org.apache.poi.hssf.usermodel.HSSFCellStyle;
+import org.apache.poi.hssf.usermodel.HSSFRow;
+import org.apache.poi.hssf.usermodel.HSSFSheet;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.hibernate.query.internal.NativeQueryImpl;
+import org.hibernate.transform.Transformers;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.Query;
+import javax.servlet.http.HttpServletResponse;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+@Service
+public class TermReportServiceImpl implements TermReportService {
+
+
+    @Autowired
+    private SystemUtilService systemUtilService;
+
+    @PersistenceContext
+    private EntityManager entityManager;
+
+    private static final Logger logger = LoggerFactory.getLogger(TermReportServiceImpl.class);
+
+
+    @Override
+    public List<TermReportShowBean> getTermReportSearchData(TermReportSearchBean searchBean) {
+        if (null != searchBean) {
+            String startdate = DateUtil.unParseToDateFormat(searchBean.getStartdate());
+            String enddate = DateUtil.unParseToDateFormat(searchBean.getEnddate());
+
+            StringBuffer sb = new StringBuffer("select t.termid," +
+                    " sum(case when t.revflag=1 then 0 when t.transtype='revert' then 0 when t.managefeetype ='normal' and t.mealtype='breakfast' then t.amount else 0 end) as b_normalamt," +
+                    " sum(case when t.revflag=1 then 0 when t.transtype='revert' then 0 when t.managefeetype ='normal' and t.mealtype='breakfast' then 1 else 0 end) as b_normalcnt," +
+                    " sum(case when t.revflag=1 then 0 when t.transtype='revert' then 0 when t.managefeetype in ('discount','reduction','quota')  and t.mealtype='breakfast' then 1 else 0 end) as b_discountcnt, " +
+                    " sum(case when t.revflag=1 then 0 when t.transtype='revert' then 0 when t.managefeetype in ('discount','reduction','quota') and t.mealtype='breakfast' then t.amount else 0 end) as b_discountamt, " +
+                    " sum(case when t.revflag=1 then 0 when t.transtype='revert' then 0 when t.managefeetype ='normal' and t.mealtype='lunch' then t.amount else 0 end) as l_normalamt," +
+                    " sum(case when t.revflag=1 then 0 when t.transtype='revert' then 0 when t.managefeetype ='normal' and t.mealtype='lunch' then 1 else 0 end) as l_normalcnt," +
+                    " sum(case when t.revflag=1 then 0 when t.transtype='revert' then 0 when t.managefeetype in ('discount','reduction','quota') and t.mealtype='lunch' then 1 else 0 end) as l_discountcnt, " +
+                    " sum(case when t.revflag=1 then 0 when t.transtype='revert' then 0 when t.managefeetype in ('discount','reduction','quota') and t.mealtype='lunch' then t.amount else 0 end) as l_discountamt, " +
+                    " sum(case when t.revflag=1 then 0 when t.transtype='revert' then 0 when t.managefeetype ='normal' and t.mealtype='dinner' then t.amount else 0 end) as d_normalamt," +
+                    " sum(case when t.revflag=1 then 0 when t.transtype='revert' then 0 when t.managefeetype ='normal' and t.mealtype='dinner' then 1 else 0 end) as d_normalcnt," +
+                    " sum(case when t.revflag=1 then 0 when t.transtype='revert' then 0 when t.managefeetype in ('discount','reduction','quota') and t.mealtype='dinner' then 1 else 0 end) as d_discountcnt, " +
+                    " sum(case when t.revflag=1 then 0 when t.transtype='revert' then 0 when t.managefeetype in ('discount','reduction','quota') and t.mealtype='dinner' then t.amount else 0 end) as d_discountmt," +
+                    " sum(case when t.revflag=1 then 0 when t.transtype='revert' then 0 when t.managefeetype in ('discount','reduction','quota') then 1 else 0 end) as totdiscountcnt, " +
+                    " sum(case when t.revflag=1 then 0 when t.transtype='revert' then 0 when t.managefeetype in ('discount','reduction','quota') then t.amount else 0 end) as totdiscountamt," +
+                    " sum(case when t.revflag=1 then 0 when t.transtype='revert' then 0 when t.managefeetype in ('discount','reduction','quota') then t.managefee else 0 end) as totfeeamt," +
+                    " sum(case when t.revflag=1 then 0 when t.transtype='revert' then 0 when t.managefeetype ='normal'   then t.amount else 0 end) as totnormalamt," +
+                    " sum(case when t.revflag=1 then 0 when t.transtype='revert' then 0 when t.managefeetype ='normal'  then 1 else 0 end) as totnormalcnt" +
+                    " from tb_transdtl t  " +
+                    " left join tb_device dev on t.termid=dev.id " +
+                    " left join tb_shopsettlement s on s.shopid=t.shopid" +
+                    " left join tb_discount_rule r on r.ruleid=t.ruleid" +
+                    " where t.status='success' " +
+                    " and t.accdate>=:startdate and t.accdate<=:enddate ") ;
+            if (StringUtil.isEmpty(searchBean.getShopid())) {
+                sb.append( " and s.shopid = :shopid ");
+            }
+            if (StringUtil.isEmpty(searchBean.getShopname())) {
+                sb.append( " and s.shopid like :shopname ");
+            }
+            if (null!=searchBean.getDevgroupid()) {
+                sb.append( " and dev.devgroupid = :groupid ");
+            }
+            if (null!=searchBean.getRuleid()) {
+                sb.append( " and r.ruleid = :ruleid ");
+            }
+            sb.append(" group by dev.devgroupid,t.termid,s.shopname");
+            Query query = entityManager.createNativeQuery(sb.toString());
+            query.setParameter("startdate", startdate);
+            query.setParameter("enddate", enddate);
+            if (null!=searchBean.getDevgroupid()) {
+                query.setParameter("groupid", searchBean.getDevgroupid());
+            }
+            if (StringUtil.isEmpty(searchBean.getShopid())) {
+                query.setParameter("shopid", searchBean.getShopid().trim()  );
+            }
+            if (StringUtil.isEmpty(searchBean.getShopname())) {
+                query.setParameter("shopname","%" + searchBean.getShopname().trim() + "%");
+            }
+            if (null!=searchBean.getRuleid()) {
+                query.setParameter("ruleid", searchBean.getRuleid());
+            }
+            query.unwrap(NativeQueryImpl.class).setResultTransformer(Transformers.aliasToBean(TermReportShowBean.class));
+            List<TermReportShowBean> list = query.getResultList();
+            if (null != list) return list;
+        }
+        return new ArrayList<>(0);
+
+    }
+    @Override
+    public String getTermReportSearchPeriod(TermReportSearchBean searchBean) {
+        String startdate = DateUtil.unParseToDateFormat(searchBean.getStartdate());
+        String enddate = DateUtil.unParseToDateFormat(searchBean.getEnddate());
+        if (startdate.equals(enddate)) {
+            return DateUtil.reformatDatetime(startdate, "yyyyMMdd", "yyyy年MM月dd日");
+        } else {
+            return DateUtil.reformatDatetime(startdate, "yyyyMMdd", "yyyy年MM月dd日") + " ~ " + DateUtil.reformatDatetime(enddate, "yyyyMMdd", "yyyy年MM月dd日");
+        }
+    }
+
+
+    @Override
+    public void doCreateTermReportExcel(HttpServletResponse response, List<TermReportShowBean> datalist, TermReportSearchBean searchBean, String filename, TOperator oper) {
+        HSSFWorkbook workbook = new HSSFWorkbook();
+        HSSFSheet sheet = workbook.createSheet("终端消费报表");
+
+        int columns = 10; //
+        sheet.setColumnWidth(0, ExcelPoiUtil.columnWidth(25)); //日期
+        for (int i = 3; i < columns; i++) {
+            sheet.setColumnWidth(i, ExcelPoiUtil.columnWidth(12));
+        }
+
+        //标题样式
+        HSSFCellStyle titleStyle = ExcelPoiUtil.creatStyle(workbook, "宋体", true, 20, HSSFCellStyle.ALIGN_CENTER, false); //设置单元格样式
+        //表头样式
+        HSSFCellStyle headStyle = ExcelPoiUtil.creatStyle(workbook, "宋体", true, 15, HSSFCellStyle.ALIGN_CENTER, true); //设置单元格样式
+        //正文样式 有边框-textStyle1 无边框-textStyle2
+        HSSFCellStyle textStyle1 = ExcelPoiUtil.creatStyle(workbook, "宋体", false, 10, HSSFCellStyle.ALIGN_CENTER, true); //设置单元格样式
+        HSSFCellStyle textStyle2 = ExcelPoiUtil.creatStyle(workbook, "宋体", false, 10, HSSFCellStyle.ALIGN_CENTER, false); //设置单元格样式
+
+
+        //TODO:创建标题
+        HSSFRow row0 = ExcelPoiUtil.createRow(sheet, 0, 800); //表格标题
+        ExcelPoiUtil.createCell(row0, 0, titleStyle, filename);
+        sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, columns - 1)); //合并单元格CellRangeAddress构造参数依次表示 起始行,截至行,起始列, 截至列
+
+        //TODO:创建表格页眉
+        HSSFRow row1 = ExcelPoiUtil.createRow(sheet, 1, 400);
+        ExcelPoiUtil.createCell(row1, 0, textStyle2, "区间");
+        ExcelPoiUtil.createCell(row1, 1, textStyle2, getTermReportSearchPeriod(searchBean));
+        ExcelPoiUtil.createCell(row1, 2, textStyle2, null);
+        ExcelPoiUtil.createCell(row1, 3, textStyle2, null);
+        ExcelPoiUtil.createCell(row1, 4, textStyle2, null);
+
+        sheet.addMergedRegion(new CellRangeAddress(1, 1, 1, 4));
+        ExcelPoiUtil.createCell(row1, columns - 1, ExcelPoiUtil.creatStyle(workbook, "宋体", false, 10, HSSFCellStyle.ALIGN_RIGHT, false), "单位:元");
+
+        //TODO:创建表头(poi做多行合并,一定需要先绘制单元格,然后写入数据,最后合并)
+        HSSFRow row2 = ExcelPoiUtil.createRow(sheet, 2, 600);
+        ExcelPoiUtil.createCell(row2, 0, headStyle, "序号");
+        ExcelPoiUtil.createCell(row2, 1, headStyle, "食堂");
+
+        ExcelPoiUtil.createCell(row2, 2, headStyle, "含餐补消费支付");
+        ExcelPoiUtil.createCell(row2, 3, headStyle, null);
+        ExcelPoiUtil.createCell(row2, 4, headStyle, null);
+        ExcelPoiUtil.createCell(row2, 5, headStyle, null);
+        ExcelPoiUtil.createCell(row2, 6, headStyle, null);
+        ExcelPoiUtil.createCell(row2, 7, headStyle, null);
+
+        sheet.addMergedRegion(new CellRangeAddress(2, 2, 2, 7)); //合并单元格CellRangeAddress构造参数依次表示 起始行,截至行,起始列, 截至列
+
+        ExcelPoiUtil.createCell(row2, 8, headStyle, "无餐补消费支付");
+        ExcelPoiUtil.createCell(row2, 9, headStyle, null);
+        ExcelPoiUtil.createCell(row2, 10, headStyle, null);
+        sheet.addMergedRegion(new CellRangeAddress(2, 2, 8, 10)); //合并单元格CellRangeAddress构造参数依次表示 起始行,截至行,起始列, 截至列
+
+
+        ExcelPoiUtil.createCell(row2, 11, headStyle, "合计 消费金额");
+        ExcelPoiUtil.createCell(row2, 12, headStyle, "合计 消费笔数");
+        HSSFRow row3 = ExcelPoiUtil.createRow(sheet, 3, 800); //表头第二行
+        ExcelPoiUtil.createCell(row3, 0, headStyle, null);
+        sheet.addMergedRegion(new CellRangeAddress(2, 3, 0, 0)); //合并列
+
+        ExcelPoiUtil.createCell(row3, 1, headStyle, null);
+        sheet.addMergedRegion(new CellRangeAddress(2, 3, 1, 1)); //合并列
+
+        ExcelPoiUtil.createCell(row3, 11, headStyle, null);
+        sheet.addMergedRegion(new CellRangeAddress(2, 3, 11, 11)); //合并列
+
+        ExcelPoiUtil.createCell(row3, 12, headStyle, null);
+        sheet.addMergedRegion(new CellRangeAddress(2, 3, 12, 12)); //合并列
+
+        ExcelPoiUtil.createCell(row3, 2, headStyle, "早餐 金额");
+        ExcelPoiUtil.createCell(row3, 3, headStyle, "早餐 份数");
+        ExcelPoiUtil.createCell(row3, 4, headStyle, "午餐 金额");
+        ExcelPoiUtil.createCell(row3, 5, headStyle, "午餐 份数");
+        ExcelPoiUtil.createCell(row3, 6, headStyle, "晚餐 金额");
+        ExcelPoiUtil.createCell(row3, 7, headStyle, "晚餐 份数");
+
+ //       ExcelPoiUtil.createCell(row3, 8, headStyle, "早餐 金额");
+        ExcelPoiUtil.createCell(row3, 8, headStyle, "早餐 份数");
+   //     ExcelPoiUtil.createCell(row3, 10, headStyle, "午餐 金额");
+        ExcelPoiUtil.createCell(row3, 9, headStyle, "午餐 份数");
+ //       ExcelPoiUtil.createCell(row3, 12, headStyle, "晚餐 金额");
+        ExcelPoiUtil.createCell(row3, 10, headStyle, "晚餐 份数");
+
+        //TODO: 数据
+        int rowNum = 4;
+        if (StringUtil.isEmpty(datalist)) {
+            //无数据
+            HSSFRow row4 = ExcelPoiUtil.createRow(sheet, rowNum, 500);
+            ExcelPoiUtil.createCell(row4, 0, textStyle1, "无数据");
+            for (int n = 1; n < columns; n++) ExcelPoiUtil.createCell(row4, n, textStyle1, null);
+            sheet.addMergedRegion(new CellRangeAddress(rowNum, rowNum, 0, columns - 1)); //合并列
+        } else {
+            //有数据
+            for (int i = 0; i < datalist.size(); i++) {
+                TermReportShowBean detail = datalist.get(i);
+                HSSFRow row = ExcelPoiUtil.createRow(sheet, rowNum++, 500);
+  /*              ExcelPoiUtil.createCell(row, 0, textStyle1,""+ detail.getRownum());
+                ExcelPoiUtil.createCell(row, 1, textStyle1, detail.getGroupname());
+                ExcelPoiUtil.createCell(row, 2, textStyle1, MoneyUtil.formatYuanToString(detail.getIbtotalamt()));
+                ExcelPoiUtil.createCell(row, 3, textStyle1, detail.getIbtotalcnt().toString());
+                ExcelPoiUtil.createCell(row, 4, textStyle1, MoneyUtil.formatYuanToString(detail.getIltotalamt())); //午餐
+                ExcelPoiUtil.createCell(row, 5, textStyle1, detail.getIltotalcnt().toString());
+                ExcelPoiUtil.createCell(row, 6, textStyle1, MoneyUtil.formatYuanToString(detail.getIdtotalamt())); //晚餐
+                ExcelPoiUtil.createCell(row, 7, textStyle1, detail.getIdtotalcnt().toString());
+
+                ExcelPoiUtil.createCell(row, 8, textStyle1, detail.getObtotalcnt().toString());
+                ExcelPoiUtil.createCell(row, 9, textStyle1, detail.getOltotalcnt().toString());
+                ExcelPoiUtil.createCell(row, 10, textStyle1, detail.getOdtotalcnt().toString());
+
+                ExcelPoiUtil.createCell(row, 11, textStyle1, MoneyUtil.formatYuanToString(detail.getIdtotalamt()+detail.getIbtotalamt()+detail.getIltotalamt())); //总计
+                ExcelPoiUtil.createCell(row, 12, textStyle1, detail.getIdtotalcnt()+detail.getIbtotalcnt()+detail.getIltotalcnt()+detail.getOdtotalcnt()+detail.getOltotalcnt()+detail.getObtotalcnt()+"");
+*/
+
+            }
+
+
+        }
+
+        //TODO: 表格页脚
+        HSSFCellStyle textStyle3 = ExcelPoiUtil.creatStyle(workbook, "宋体", false, 10, HSSFCellStyle.ALIGN_LEFT, false); //设置单元格样式
+        HSSFRow buttom = ExcelPoiUtil.createRow(sheet, ++rowNum, 400);
+        ExcelPoiUtil.createCell(buttom, 0, textStyle3, "制表人:" + (oper == null ? "unknow" : oper.getOpername()) + "  " + DateUtil.reformatDatetime(systemUtilService.getSysdatetime().getHostdatetime(), DateUtil.DATETIME_FMT, "yyyy-MM-dd HH:mm:ss"));
+        sheet.addMergedRegion(new CellRangeAddress(rowNum, rowNum, 0, 2));  //合并列
+
+        //TODO: 审核信息
+        HSSFRow signRow10 = ExcelPoiUtil.createRow(sheet, rowNum + 3, 400);
+        ExcelPoiUtil.createCell(signRow10, 0, textStyle3, "大理州公安局警务保障处审核盖章:");
+        ExcelPoiUtil.createCell(signRow10, 6, textStyle3, "苍山饭店审核盖章:");
+        sheet.addMergedRegion(new CellRangeAddress(rowNum + 3, rowNum + 3, 0, 5));  //合并列
+        sheet.addMergedRegion(new CellRangeAddress(rowNum + 3, rowNum + 3, 6, columns - 1));  //合并列
+        HSSFRow signRow11 = ExcelPoiUtil.createRow(sheet, rowNum + 4, 400);
+        ExcelPoiUtil.createCell(signRow11, 0, textStyle3, "经办人:");
+        ExcelPoiUtil.createCell(signRow11, 6, textStyle3, "审核人:");
+        sheet.addMergedRegion(new CellRangeAddress(rowNum + 4, rowNum + 4, 0, 5));  //合并列
+        sheet.addMergedRegion(new CellRangeAddress(rowNum + 4, rowNum + 4, 6, columns - 1));  //合并列
+
+        HSSFRow signRow12 = ExcelPoiUtil.createRow(sheet, rowNum + 5, 400);
+        ExcelPoiUtil.createCell(signRow12, 0, textStyle3, "审核人:");
+        sheet.addMergedRegion(new CellRangeAddress(rowNum + 5, rowNum + 5, 0, 5));  //合并列
+
+
+        try {
+            response.setContentType("application/x-msdownload");
+            response.setHeader("Content-Disposition", "attachment;" + " filename=" + new String(filename.getBytes(), "ISO-8859-1") + ".xls");
+            OutputStream out = response.getOutputStream();
+            workbook.write(out);
+            out.flush();
+            out.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+    }
+
+}
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/TransDtlServiceImpl.java b/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/TransDtlServiceImpl.java
index 757ef15..4e8c06e 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/TransDtlServiceImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/TransDtlServiceImpl.java
@@ -3,24 +3,26 @@
 import com.supwisdom.dlpay.api.bean.ConsumePayCancelParam;
 import com.supwisdom.dlpay.api.bean.JsonResult;
 import com.supwisdom.dlpay.api.bean.PayReverseResponse;
+import com.supwisdom.dlpay.framework.dao.OperatorQueryLimitDao;
 import com.supwisdom.dlpay.framework.dao.ShopSettlementDao;
 import com.supwisdom.dlpay.framework.domain.TShopSettlement;
 import com.supwisdom.dlpay.framework.service.SystemUtilService;
 import com.supwisdom.dlpay.framework.util.*;
 import com.supwisdom.dlpay.paysdk.proxy.TransactionProxy;
-import com.supwisdom.dlpay.restaurant.bean.AmountCountBean;
-import com.supwisdom.dlpay.restaurant.bean.ManageFeeAmtBean;
-import com.supwisdom.dlpay.restaurant.bean.SalesAmtBean;
-import com.supwisdom.dlpay.restaurant.bean.TransDtlSearchBean;
+import com.supwisdom.dlpay.restaurant.bean.*;
+import com.supwisdom.dlpay.restaurant.dao.DeviceDao;
+import com.supwisdom.dlpay.restaurant.dao.DeviceGroupDao;
 import com.supwisdom.dlpay.restaurant.dao.TransDtlDao;
+import com.supwisdom.dlpay.restaurant.domain.TDeviceGroup;
 import com.supwisdom.dlpay.restaurant.domain.TTransDtl;
 import com.supwisdom.dlpay.restaurant.service.TransDtlService;
 import com.supwisdom.dlpay.restaurant.util.DataUtil;
 import com.supwisdom.dlpay.restaurant.util.RestaurantConstant;
+import com.supwisdom.dlpay.system.domain.TOperatorQueryLimit;
+import org.apache.commons.lang3.StringUtils;
 import org.hibernate.query.internal.NativeQueryImpl;
 import org.hibernate.transform.Transformers;
 import org.jetbrains.annotations.NotNull;
-import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.PageRequest;
@@ -38,6 +40,7 @@
 import javax.persistence.criteria.Root;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import java.math.BigInteger;
 import java.util.*;
 
 @Service
@@ -52,6 +55,10 @@
     private TransactionProxy transactionProxy;
     @PersistenceContext
     private EntityManager entityManager;
+    @Autowired
+    private OperatorQueryLimitDao operatorQueryLimitDao;
+    @Autowired
+    private DeviceDao deviceDao;
 
     @Override
     public PageResult<TTransDtl> getTransDtlByParam(TransDtlSearchBean param) {
@@ -59,100 +66,279 @@
                 , Sort.by("billno").descending());
 
         Specification<TTransDtl> spec = gettTransDtlSpecification(param);
-        Page<TTransDtl> dtls= transDtlDao.findAll(spec, pageable);
-        dtls.forEach((dtl)->{
-            dtl.setCustname(DataUtil.dataDesensitization(dtl.getCustname(),1));
-            dtl.setCardno(DataUtil.dataDesensitization(dtl.getCardno(),4));
+        Page<TTransDtl> dtls = transDtlDao.findAll(spec, pageable);
+        dtls.forEach((dtl) -> {
+            dtl.setCustname(DataUtil.dataDesensitization(dtl.getCustname(), 1));
+            dtl.setCardno(DataUtil.dataDesensitization(dtl.getCardno(), 4));
         });
 
         return new PageResult<>(dtls);
     }
 
+    @Override
+    public PageResult<VTransDtl> getVTransdtlByParam(TransDtlSearchBean param) {
+        StringBuffer querySql = new StringBuffer( " SELECT t.transdate,t.transtime,t.billno,'' AS tradeno,'' AS authno,t.custname,c.bankcardno,d.rulename, " +
+                "t1.deptname,t.termid,s.shopid,s.shopname,'' AS searchno,t.amount,'' AS serviceamt,t.transtype, " +
+                "t.status,'T+1' AS cleartype,'普通' AS servicetype,0 AS revertamt,t.revbillno, " +
+                "substr((t.revbillno), 0, 9) AS revtransdate FROM ((((tb_transdtl t " +
+                "left JOIN tb_card c ON (((t.cardno) = (c.cardno)))) " +
+                "left JOIN tb_discount_rule d ON ((t.ruleid = d.ruleid))) " +
+                "left JOIN ( SELECT c_1.custid, " +
+                " p.deptname " +
+                "FROM (tb_customer c_1 " +
+                "left JOIN tb_dept p ON (((c_1.deptcode) = (p.deptcode))))) t1 ON (((t.custid) = (t1.custid)))) " +
+                "left JOIN tb_shopsettlement s ON (((t.shopid) = (s.shopid))))"+
+                " where t.transdate>=:startdate and t.transdate<=:enddate");
+        StringBuffer countSql = new StringBuffer(" SELECT count(*) as cnt FROM ((((tb_transdtl t " +
+                "left JOIN tb_card c ON (((t.cardno) = (c.cardno)))) " +
+                "left JOIN tb_discount_rule d ON ((t.ruleid = d.ruleid))) " +
+                "left JOIN ( SELECT c_1.custid, " +
+                " p.deptname " +
+                "FROM (tb_customer c_1 " +
+                "left JOIN tb_dept p ON (((c_1.deptcode) = (p.deptcode))))) t1 ON (((t.custid) = (t1.custid)))) " +
+                "left JOIN tb_shopsettlement s ON (((t.shopid) = (s.shopid))))"+
+                " where t.transdate>=:startdate and t.transdate<=:enddate");
+
+        if (!StringUtil.isEmpty(param.getOpercode())) {
+            TOperatorQueryLimit limit = operatorQueryLimitDao.findByOpercode(param.getOpercode());
+
+            if (null != limit) {
+                List<Integer> devlist = deviceDao.getIdByDevgroupid(limit.getDevgroupid());
+                if (StringUtil.isEmpty(devlist)) {
+                    devlist.add(0);
+                }
+                querySql.append(" and t.termid in ("+ StringUtils.join(devlist.toArray(),",")+") ");
+                countSql.append(" and t.termid in ("+ StringUtils.join(devlist.toArray(),",")+") ");
+            }
+        }
+
+
+        if (!StringUtil.isEmpty(param.getCustname())) {
+            querySql.append(" and  t.custname like :str ");
+            countSql.append(" and  t.custname like :str ");
+        }
+        if (!StringUtil.isEmpty(param.getBillno())) {
+            querySql.append(" and  t.billno like :billno ");
+            countSql.append(" and  t.billno like :billno ");
+        }
+        if (null!=param.getTermid()) {
+            querySql.append(" and  t.termid = :termid ");
+            countSql.append(" and  t.termid = :termid ");
+        }
+
+        querySql.append(" order by t.billno desc ");
+        Query query = entityManager.createNativeQuery(querySql.toString());
+        Query countQuery = entityManager.createNativeQuery(countSql.toString());
+        if (!StringUtil.isEmpty(param.getCustname())) {
+            query.setParameter("str", "%" + param.getCustname().trim() + "%");
+            countQuery.setParameter("str", "%" + param.getCustname().trim() + "%");
+        }
+        if (!StringUtil.isEmpty(param.getBillno())) {
+            query.setParameter("billno", "%" + param.getBillno().trim() + "%");
+            countQuery.setParameter("billno", "%" + param.getBillno().trim() + "%");
+        }
+        if (null!=param.getTermid()) {
+            query.setParameter("termid", param.getTermid());
+            countQuery.setParameter("termid", param.getTermid());
+        }
+        query.setParameter("startdate", param.getStartdate().trim());
+        countQuery.setParameter("startdate", param.getStartdate().trim());
+        query.setParameter("enddate", param.getEnddate().trim());
+        countQuery.setParameter("enddate", param.getEnddate().trim());
+
+        query.setFirstResult((param.getPageNo() - 1) * param.getPageSize());
+        query.setMaxResults(param.getPageSize()); //分页显示
+        query.unwrap(NativeQueryImpl.class).setResultTransformer(Transformers.aliasToBean(VTransDtl.class));
+        List<VTransDtl> list = query.getResultList();
+        if (null != list) {
+            for (VTransDtl bean : list) {
+                bean.setCustname(DataUtil.dataDesensitization(bean.getCustname(), 1));
+            }
+        }
+
+        BigInteger count = (BigInteger) countQuery.getSingleResult();
+        return new PageResult<>(count.longValue(), list);
+    }
+
     @NotNull
     private Specification<TTransDtl> gettTransDtlSpecification(TransDtlSearchBean param) {
         return new Specification<TTransDtl>() {        //查询条件构造
-                @Override
-                public Predicate toPredicate(Root<TTransDtl> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder cb) {
-                    List<Predicate> list = new ArrayList<>();
+            @Override
+            public Predicate toPredicate(Root<TTransDtl> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder cb) {
+                List<Predicate> list = new ArrayList<>();
 
-                    if (!StringUtil.isEmpty(param.getBillno())) {
-                        list.add(cb.like(root.get("billno").as(String.class), "%" + param.getBillno() + "%"));
-                    }
-                    if (!StringUtil.isEmpty(param.getCustname())) {
-                        list.add(cb.like(root.get("custname").as(String.class), "%" + param.getCustname() + "%"));
-                    }
-                    if (!StringUtil.isEmpty(param.getStartdate())) {
-                        list.add(cb.greaterThanOrEqualTo(root.get("transdate").as(String.class), param.getStartdate()));
-                    }
-                    if (!StringUtil.isEmpty(param.getEnddate())) {
-                        list.add(cb.lessThanOrEqualTo(root.get("transdate").as(String.class), param.getEnddate()));
-                    }
-                    if (!StringUtil.isEmpty(param.getAccdate())) {
-                        list.add(cb.equal(root.get("accdate").as(String.class), param.getAccdate()));
-                    }
-                    if (!StringUtil.isEmpty(param.getShopid())) {
-                        list.add(cb.equal(root.get("shopid").as(String.class), param.getShopid()));
-                    }
-                    if (!StringUtil.isEmpty(param.getStatus())) {
-                        list.add(cb.equal(root.get("status").as(String.class), param.getStatus()));
-                    }
-                    if (null!=param.getTermid()) {
-                        list.add(cb.like(root.get("termid").as(String.class), param.getTermid().toString()));
-                    }
-
-                    return cb.and(list.toArray(new Predicate[list.size()]));
+                if (!StringUtil.isEmpty(param.getBillno())) {
+                    list.add(cb.like(root.get("billno").as(String.class), "%" + param.getBillno() + "%"));
                 }
-            };
+                if (!StringUtil.isEmpty(param.getCustname())) {
+                    list.add(cb.like(root.get("custname").as(String.class), "%" + param.getCustname() + "%"));
+                }
+                if (!StringUtil.isEmpty(param.getStartdate())) {
+                    list.add(cb.greaterThanOrEqualTo(root.get("transdate").as(String.class), param.getStartdate()));
+                }
+                if (!StringUtil.isEmpty(param.getEnddate())) {
+                    list.add(cb.lessThanOrEqualTo(root.get("transdate").as(String.class), param.getEnddate()));
+                }
+                if (!StringUtil.isEmpty(param.getAccdate())) {
+                    list.add(cb.equal(root.get("accdate").as(String.class), param.getAccdate()));
+                }
+                if (!StringUtil.isEmpty(param.getShopid())) {
+                    list.add(cb.equal(root.get("shopid").as(String.class), param.getShopid()));
+                }
+                if (!StringUtil.isEmpty(param.getStatus())) {
+                    list.add(cb.equal(root.get("status").as(String.class), param.getStatus()));
+                }
+                if (null != param.getTermid()) {
+                    list.add(cb.like(root.get("termid").as(String.class), param.getTermid().toString()));
+                }
+                if (!StringUtil.isEmpty(param.getOpercode())) {
+                    TOperatorQueryLimit limit = operatorQueryLimitDao.findByOpercode(param.getOpercode());
+
+                    if (null != limit) {
+                        List<Integer> devlist = deviceDao.getIdByDevgroupid(limit.getDevgroupid());
+                        if (StringUtil.isEmpty(devlist)) {
+                            devlist.add(0);
+                        }
+                        list.add(root.get("termid").in(devlist));
+                    }
+                }
+                return cb.and(list.toArray(new Predicate[list.size()]));
+            }
+        };
     }
 
     @Override
     public JsonResult export(TransDtlSearchBean bean, HttpServletRequest request, HttpServletResponse response) {
-        String[] titles0 = {"姓名",	"交易号",	"交易金额","交易时间","记账时间","终端号","商户","流水状态","流水类型","分餐类别"
+        String[] titles0 = {"姓名", "交易号", "交易金额", "交易时间", "记账时间", "终端号", "商户", "流水状态", "流水类型", "分餐类别"
         }; //表头
         String fileName0 = "食堂流水";// 保存数据
         String[][] info0 = {{}};
         Specification<TTransDtl> spec = gettTransDtlSpecification(bean);
-        List<TTransDtl> dtl=transDtlDao.findAll(spec);
-        Integer cnt=dtl.size();
-        if(cnt>0 ){
+        List<TTransDtl> dtl = transDtlDao.findAll(spec);
+        Integer cnt = dtl.size();
+        if (cnt > 0) {
             System.out.println("---init here---");
-            info0=new String[cnt][titles0.length];
-            List<TShopSettlement> shop=shopSettlementDao.findAll();
-            Map<String,String > shopmap=new HashMap<>();
-            for(TShopSettlement s:shop){
-                shopmap.put(s.getShopid(),s.getShopname());
+            info0 = new String[cnt][titles0.length];
+            List<TShopSettlement> shop = shopSettlementDao.findAll();
+            Map<String, String> shopmap = new HashMap<>();
+            for (TShopSettlement s : shop) {
+                shopmap.put(s.getShopid(), s.getShopname());
             }
-            for(int i=0;i<cnt;i++){
-                TTransDtl t=dtl.get(i);
-                info0[i][0]=t.getCustname();
-                info0[i][1]=t.getBillno();
-                info0[i][2]=t.getAmount().toString();
-                info0[i][3]=t.getAccdate();
-                info0[i][4]=t.getTransdate();
-                info0[i][5]=t.getTermid().toString();
-                info0[i][6]=shopmap.get(t.getShopid());
-                String status="";
-                switch (t.getStatus()){
-                    case "init":status="未入账"; break;
-                    case "success":status="已入账"; break;
-                    case "fail":status="失败"; break;
-                    default:status="未知状态";
+            for (int i = 0; i < cnt; i++) {
+                TTransDtl t = dtl.get(i);
+                info0[i][0] = t.getCustname();
+                info0[i][1] = t.getBillno();
+                info0[i][2] = t.getAmount().toString();
+                info0[i][3] = t.getAccdate();
+                info0[i][4] = t.getTransdate();
+                info0[i][5] = t.getTermid().toString();
+                info0[i][6] = shopmap.get(t.getShopid());
+                String status = "";
+                switch (t.getStatus()) {
+                    case "init":
+                        status = "未入账";
+                        break;
+                    case "success":
+                        status = "已入账";
+                        break;
+                    case "fail":
+                        status = "失败";
+                        break;
+                    default:
+                        status = "未知状态";
                 }
-                info0[i][7]=status;
-                info0[i][8]=t.getTranstype();
-                String mealtype="";
-                switch (t.getMealtype()){
-                    case "breakfast":mealtype="早餐"; break;
-                    case "lunch":mealtype="午餐"; break;
-                    case "dinner":mealtype="晚餐"; break;
-                    default:mealtype="未知";
+                info0[i][7] = status;
+                info0[i][8] = t.getTranstype();
+                String mealtype = "";
+                switch (t.getMealtype()) {
+                    case "breakfast":
+                        mealtype = "早餐";
+                        break;
+                    case "lunch":
+                        mealtype = "午餐";
+                        break;
+                    case "dinner":
+                        mealtype = "晚餐";
+                        break;
+                    default:
+                        mealtype = "未知";
                 }
-                info0[i][8]=mealtype;
+                info0[i][8] = mealtype;
             }
         }
 
         try {
-            ExportExcel.queryexcel(fileName0, titles0,info0,request, response);
+            ExportExcel.queryexcel(fileName0, titles0, info0, request, response);
+            return JsonResult.ok("操作成功");
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return JsonResult.error("操作失败");
+    }
+
+    @Override
+    public JsonResult exportForView(TransDtlSearchBean bean, HttpServletRequest request, HttpServletResponse response) {
+        String[] titles0 = {"交易日期", "交易时间", "系统流水号", "核心跟踪号", "授权码", "银行卡号",
+                "姓名", "交易折扣", "所属单位", "商户编号",
+                "商户名称", "终端编号", "检索参考号", "交易金额", "手续费", "退货金额", "原交易日期",
+                "原系统流水号", "交易类型", "应答码", "交易标志", "清算类型", "业务类别"
+        }; //表头
+        String fileName0 = "食堂流水";// 保存数据
+        String[][] info0 = {{}};
+        List<VTransDtl> dtl = getVTransdtlByParam(bean).getData();
+        Integer cnt = dtl.size();
+        if (cnt > 0) {
+            info0 = new String[cnt][titles0.length];
+            List<TShopSettlement> shop = shopSettlementDao.findAll();
+            Map<String, String> shopmap = new HashMap<>();
+            for (TShopSettlement s : shop) {
+                shopmap.put(s.getShopid(), s.getShopname());
+            }
+            for (int i = 0; i < cnt; i++) {
+                VTransDtl t = dtl.get(i);
+                info0[i][0] = t.getTransdate();
+                info0[i][1] = t.getTranstime();
+                info0[i][2] = t.getBillno();
+                info0[i][3] = "";
+                info0[i][4] = "";
+                info0[i][5] = t.getBankcardno();
+                info0[i][6] = t.getCustname();
+                info0[i][7] = t.getRulename();
+                info0[i][8] = t.getDeptname();
+                info0[i][9] = t.getShopid();
+                info0[i][10] = t.getShopname();
+                info0[i][11] = t.getTermid().toString();
+                info0[i][12] = "";
+                info0[i][13] = t.getAmount().toString();
+                info0[i][14] = "";
+                info0[i][15] ="0";
+                info0[i][16] = "";
+                info0[i][17] = t.getRevbillno();
+                info0[i][18] = "在线交易";
+                info0[i][19] = "";
+                String status = "";
+                switch (t.getStatus()) {
+                    case "init":
+                        status = "初始化";
+                        break;
+                    case "success":
+                        status = "成功";
+                        break;
+                    case "fail":
+                        status = "失败";
+                        break;
+                    default:
+                        status = "未知状态";
+                }
+                info0[i][20]=status;
+                info0[i][21]=status;
+                info0[i][22]="T+1";
+                info0[i][23]="普通";
+            }
+        }
+
+        try {
+            ExportExcel.queryexcel(fileName0, titles0, info0, request, response);
             return JsonResult.ok("操作成功");
         } catch (Exception e) {
             e.printStackTrace();
@@ -172,18 +358,18 @@
 
     @Override
     public TTransDtl getPosTransdtl(Integer termid, Integer termsqlno, String termdate) {
-        return transDtlDao.getByTransdateAndTermidAndTermsqlno(termdate,termid,termsqlno);
+        return transDtlDao.getByTransdateAndTermidAndTermsqlno(termdate, termid, termsqlno);
     }
 
 
     @Override
     public JsonResult revertTransdtl(TTransDtl dtl) {
-        TTransDtl revdtl=doRevertTransdtl(dtl);
-        if(null==revdtl){
+        TTransDtl revdtl = doRevertTransdtl(dtl);
+        if (null == revdtl) {
             return JsonResult.error("撤销流水未查询到");
         }
-        if (!RestaurantConstant.STATUS_TRANSDTL_SUCCESS.equals(revdtl.getStatus())){
-            return JsonResult.error("冲正失败,"+revdtl.getAttr1());
+        if (!RestaurantConstant.STATUS_TRANSDTL_SUCCESS.equals(revdtl.getStatus())) {
+            return JsonResult.error("冲正失败," + revdtl.getAttr1());
         }
         return JsonResult.ok("操作成功");
     }
@@ -191,21 +377,21 @@
     @Override
     public TTransDtl doRevertTransdtl(TTransDtl dtl) {
         TTransDtl targetDtl;
-        Optional<TTransDtl> odtl=transDtlDao.findById(dtl.getBillno());
-        if(!odtl.isPresent()){
-            targetDtl=new TTransDtl();
+        Optional<TTransDtl> odtl = transDtlDao.findById(dtl.getBillno());
+        if (!odtl.isPresent()) {
+            targetDtl = new TTransDtl();
             targetDtl.setBillno(systemUtilService.getRefno());
             targetDtl.setStatus(RestaurantConstant.STATUS_TRANSDTL_FAIL);
             targetDtl.setAttr1("未查询到目标流水");
             transDtlDao.save(targetDtl);
             return targetDtl;
         }
-        targetDtl=odtl.get();
-        TTransDtl revDtl=new TTransDtl();
+        targetDtl = odtl.get();
+        TTransDtl revDtl = new TTransDtl();
         revDtl.setBillno(systemUtilService.getRefno());
         revDtl.setStatus(RestaurantConstant.STATUS_TRANSDTL_INIT);
-        String date=DateUtil.getNow("yyyyMMdd");
-        String time=DateUtil.getNow("HHmmss");
+        String date = DateUtil.getNow("yyyyMMdd");
+        String time = DateUtil.getNow("HHmmss");
         revDtl.setTransdate(date);
         revDtl.setTranstime(time);
         revDtl.setRevbillno(targetDtl.getBillno());
@@ -215,9 +401,9 @@
         revDtl.setTermid(targetDtl.getTermid());
         revDtl.setShopid(targetDtl.getShopid());
         revDtl.setMealtype(targetDtl.getMealtype());
-        Double managefee=targetDtl.getManagefee();
-        if(null!=managefee){
-            revDtl.setManagefee(managefee*-1.00);
+        Double managefee = targetDtl.getManagefee();
+        if (null != managefee) {
+            revDtl.setManagefee(managefee * -1.00);
         }
         revDtl.setRuleid(targetDtl.getRuleid());
         revDtl.setCustid(targetDtl.getCustid());
@@ -225,20 +411,20 @@
         revDtl.setCustname(targetDtl.getCustname());
         revDtl.setCusttype(targetDtl.getCusttype());
         revDtl.setTranstype(RestaurantConstant.TRANSTYPE_TRANSDTL_REVERT);
-        revDtl.setAmount(targetDtl.getAmount()*-1.00);
-      //  revDtl=transDtlDao.save(revDtl);
-        ConsumePayCancelParam cancelParam=new ConsumePayCancelParam();
-      //  cancelParam.setBillno(revDtl.getBillno());
+        revDtl.setAmount(targetDtl.getAmount() * -1.00);
+        //  revDtl=transDtlDao.save(revDtl);
+        ConsumePayCancelParam cancelParam = new ConsumePayCancelParam();
+        //  cancelParam.setBillno(revDtl.getBillno());
         cancelParam.setRefno(targetDtl.getRefno());
         cancelParam.setRequestbillno(revDtl.getBillno());
-       // cancelParam.setShopaccno(revDtl.getShopid());
+        // cancelParam.setShopaccno(revDtl.getShopid());
         cancelParam.setTransdate(revDtl.getTransdate());
         cancelParam.setTranstime(revDtl.getTranstime());
-        PayReverseResponse reverseResp=transactionProxy.payCancel(cancelParam);
+        PayReverseResponse reverseResp = transactionProxy.payCancel(cancelParam);
         revDtl.setStatus(RestaurantConstant.STATUS_TRANSDTL_SUCCESS);
-        if(reverseResp.getRetcode()!=0){
+        if (reverseResp.getRetcode() != 0) {
             revDtl.setStatus(RestaurantConstant.STATUS_TRANSDTL_FAIL);
-            revDtl.setAttr1(reverseResp.getRetmsg()+","+reverseResp.getException());
+            revDtl.setAttr1(reverseResp.getRetmsg() + "," + reverseResp.getException());
             transDtlDao.save(revDtl);
             return revDtl;
         }
@@ -253,7 +439,7 @@
 
     @Override
     public Integer getMaxSeqnoToday(Integer deviceid, String accdate) {
-        Integer onlineseqno= transDtlDao.getMaxSqlnoToday(deviceid,accdate);
+        Integer onlineseqno = transDtlDao.getMaxSqlnoToday(deviceid, accdate);
         if (null == onlineseqno) {
             onlineseqno = 0;
         }
@@ -267,25 +453,25 @@
                         " from tb_transdtl where transdate=:transdate and termid=:termid and managefee!=0 and status=:stat ");
 
         Query query = entityManager.createNativeQuery(querySql.toString());
-        query.setParameter("transdate",transdate);
-        query.setParameter("termid",termid);
+        query.setParameter("transdate", transdate);
+        query.setParameter("termid", termid);
         query.setParameter("stat", RestaurantConstant.STATUS_TRANSDTL_SUCCESS);
         query.unwrap(NativeQueryImpl.class).setResultTransformer(Transformers.aliasToBean(AmountCountBean.class));
         List<AmountCountBean> list = query.getResultList();
-        if(!StringUtil.isEmpty(list)){
+        if (!StringUtil.isEmpty(list)) {
             AmountCountBean acb = list.get(0);
             ManageFeeAmtBean bean = new ManageFeeAmtBean();
             bean.setManagefeecnt(acb.getTotalcnt().longValue());
             bean.setManagefeeamt(acb.getTotalamt() == null ? 0 : Math.round(acb.getTotalamt() * 100));
             return bean;
         }
-        return new ManageFeeAmtBean(0l,0l);
+        return new ManageFeeAmtBean(0l, 0l);
     }
 
     @Override
     public SalesAmtBean getSalesToday(String transdate, Integer termid) {
         StringBuffer querySql = new StringBuffer("select sum(amount) as totalamt,count(billno) as totalcnt " +
-            "from tb_transdtl where transdate=:transdate and termid=:termid and status=:stat ");
+                "from tb_transdtl where transdate=:transdate and termid=:termid and status=:stat ");
 
         Query query = entityManager.createNativeQuery(querySql.toString());
         query.setParameter("transdate", transdate);
@@ -305,27 +491,27 @@
 
     @Override
     public List<TTransDtl> getSubmittingTransdtl(String date) {
-        return transDtlDao.findAllByStatusAndTransdate(RestaurantConstant.STATUS_TRANSDTL_WAIT,date);
+        return transDtlDao.findAllByStatusAndTransdate(RestaurantConstant.STATUS_TRANSDTL_WAIT, date);
     }
 
     @Override
     public Integer getDiscountLimitToday(String termdate, String custid, Integer ruleid) {
-        return transDtlDao.countByAccdateAndCustidAndRuleidAndStatusAndRevflag(termdate,custid,ruleid,RestaurantConstant.STATUS_TRANSDTL_SUCCESS,0);
+        return transDtlDao.countByAccdateAndCustidAndRuleidAndStatusAndRevflag(termdate, custid, ruleid, RestaurantConstant.STATUS_TRANSDTL_SUCCESS, 0);
     }
 
     @Override
     public Integer getDiscountLimitTodayWithPeriod(String termdate, String custid, Integer ruleid, String starttime, String endtime) {
-        return transDtlDao.countTrandtlByAccdateAndCustidAndRuleidWithPeriod(termdate,custid,ruleid,starttime,endtime);
+        return transDtlDao.countTrandtlByAccdateAndCustidAndRuleidWithPeriod(termdate, custid, ruleid, starttime, endtime);
     }
 
     @Override
     public Integer getDiscountLimitMonth(String termdate, String custid, Integer ruleid) {
-        return transDtlDao.countTrandtlByAccdateAndCustidAndRuleidWithMonth(termdate,custid,ruleid);
+        return transDtlDao.countTrandtlByAccdateAndCustidAndRuleidWithMonth(termdate, custid, ruleid);
     }
 
     @Override
     public Integer getDiscountLimitMonthWithPeriod(String termdate, String custid, Integer ruleid, String starttime, String endtime) {
-        return transDtlDao.countTrandtlByAccdateAndCustidAndRuleidWithMonthAndPeriod(termdate,custid,ruleid,starttime,endtime);
+        return transDtlDao.countTrandtlByAccdateAndCustidAndRuleidWithMonthAndPeriod(termdate, custid, ruleid, starttime, endtime);
     }
 
 
diff --git a/src/main/java/com/supwisdom/dlpay/system/controller/OperatorController.java b/src/main/java/com/supwisdom/dlpay/system/controller/OperatorController.java
index a727ed8..9b1e6f7 100644
--- a/src/main/java/com/supwisdom/dlpay/system/controller/OperatorController.java
+++ b/src/main/java/com/supwisdom/dlpay/system/controller/OperatorController.java
@@ -8,8 +8,13 @@
 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.restaurant.domain.TDevice;
+import com.supwisdom.dlpay.restaurant.domain.TDeviceGroup;
+import com.supwisdom.dlpay.restaurant.service.DeviceGroupService;
+import com.supwisdom.dlpay.restaurant.util.RestaurantConstant;
 import com.supwisdom.dlpay.system.bean.LogBean;
 import com.supwisdom.dlpay.system.bean.OperatorSearchBean;
+import com.supwisdom.dlpay.system.domain.TOperatorQueryLimit;
 import com.supwisdom.dlpay.system.service.OperatorService;
 import com.supwisdom.dlpay.system.service.RoleService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -20,6 +25,7 @@
 import org.springframework.ui.ModelMap;
 import org.springframework.web.bind.annotation.*;
 
+import java.net.URLDecoder;
 import java.util.List;
 
 
@@ -30,6 +36,8 @@
     private OperatorService operatorService;
     @Autowired
     private RoleService roleService;
+    @Autowired
+    private DeviceGroupService deviceGroupService;
 
     @GetMapping("/index")
     @PreAuthorize("hasPermission('/operator/index','')")
@@ -219,4 +227,28 @@
         operatorService.saveOperator(operator);
         return JsonResult.ok("密码修改成功,请重新登录");
     }
+
+    @GetMapping("/getquerylimit")
+    public String getQueryLimit(
+            @RequestParam("opercode") String opercode,
+            Model model) {
+
+        TOperatorQueryLimit limit=operatorService.getOperatorQueryLimit(opercode);
+        if(null!=limit){
+            model.addAttribute("limit",limit.getDevgroupid());
+
+        }
+        return "system/operator/limitform";
+    }
+
+    @PostMapping("/updatelimit")
+    @ResponseBody
+    public JsonResult updateLimit(@RequestBody TOperatorQueryLimit limit) {
+        if (limit != null) {
+            operatorService.saveOperatorQueryLimit(limit);
+            return JsonResult.ok("操作成功");
+        } else {
+            return JsonResult.error("失败");
+        }
+    }
 }
diff --git a/src/main/java/com/supwisdom/dlpay/system/domain/TOperatorQueryLimit.java b/src/main/java/com/supwisdom/dlpay/system/domain/TOperatorQueryLimit.java
new file mode 100644
index 0000000..be2fb41
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/system/domain/TOperatorQueryLimit.java
@@ -0,0 +1,30 @@
+package com.supwisdom.dlpay.system.domain;
+
+import javax.persistence.*;
+
+@Entity
+@Table(name = "TB_Oper_Query_limit")
+public class TOperatorQueryLimit {
+
+    private String opercode;
+    private Integer devgroupid;
+
+    @Id
+    @Column(name = "opercode", nullable = false, length = 32)
+    public String getOpercode() {
+        return opercode;
+    }
+
+    public void setOpercode(String opercode) {
+        this.opercode = opercode;
+    }
+
+    @Column(name = "devgroupid",  nullable = false, length = 8)
+    public Integer getDevgroupid() {
+        return devgroupid;
+    }
+
+    public void setDevgroupid(Integer devgroupid) {
+        this.devgroupid = devgroupid;
+    }
+}
\ No newline at end of file
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/OperatorService.java b/src/main/java/com/supwisdom/dlpay/system/service/OperatorService.java
index 3954045..5cf41fd 100644
--- a/src/main/java/com/supwisdom/dlpay/system/service/OperatorService.java
+++ b/src/main/java/com/supwisdom/dlpay/system/service/OperatorService.java
@@ -8,7 +8,8 @@
 import com.supwisdom.dlpay.system.bean.OperatorSearchBean;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
-
+import
+        com.supwisdom.dlpay.system.domain.TOperatorQueryLimit;
 import java.util.List;
 
 public interface OperatorService {
@@ -41,4 +42,10 @@
 
     @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
     boolean saveOperator(TOperator operator);
+
+    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
+    TOperatorQueryLimit getOperatorQueryLimit(String opercode);
+
+    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
+    boolean saveOperatorQueryLimit(TOperatorQueryLimit limit);
 }
diff --git a/src/main/java/com/supwisdom/dlpay/system/service/impl/OperatorServiceImpl.java b/src/main/java/com/supwisdom/dlpay/system/service/impl/OperatorServiceImpl.java
index e58032e..c2130f2 100644
--- a/src/main/java/com/supwisdom/dlpay/system/service/impl/OperatorServiceImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/system/service/impl/OperatorServiceImpl.java
@@ -3,6 +3,7 @@
 import com.supwisdom.dlpay.framework.dao.OperLogDao;
 import com.supwisdom.dlpay.framework.dao.OperRoleDao;
 import com.supwisdom.dlpay.framework.dao.OperatorDao;
+import com.supwisdom.dlpay.framework.dao.OperatorQueryLimitDao;
 import com.supwisdom.dlpay.framework.domain.TOperLog;
 import com.supwisdom.dlpay.framework.domain.TOperRole;
 import com.supwisdom.dlpay.framework.domain.TOperator;
@@ -18,6 +19,7 @@
 import org.springframework.data.jpa.domain.Specification;
 import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
 import org.springframework.stereotype.Service;
+import com.supwisdom.dlpay.system.domain.TOperatorQueryLimit;
 
 import javax.persistence.criteria.CriteriaBuilder;
 import javax.persistence.criteria.CriteriaQuery;
@@ -35,6 +37,8 @@
     private OperRoleDao operRoleDao;
     @Autowired
     private OperLogDao operLogDao;
+    @Autowired
+    private OperatorQueryLimitDao operatorQueryLimitDao;
 
     @Override
     public PageResult<TOperator> getOperatorsByPage(int pageNo, int pageSize, OperatorSearchBean searchBean) {
@@ -170,4 +174,16 @@
         operatorDao.save(operator);
         return true;
     }
+
+    @Override
+    public TOperatorQueryLimit getOperatorQueryLimit(String opercode) {
+        TOperatorQueryLimit limit=operatorQueryLimitDao.findByOpercode(opercode);
+        return limit;
+    }
+
+    @Override
+    public boolean saveOperatorQueryLimit(TOperatorQueryLimit limit) {
+        operatorQueryLimitDao.save(limit);
+        return true;
+    }
 }
diff --git a/src/main/resources/templates/restaurant/custtypereport/index.html b/src/main/resources/templates/restaurant/custtypereport/index.html
index 8a42ce1..3197913 100644
--- a/src/main/resources/templates/restaurant/custtypereport/index.html
+++ b/src/main/resources/templates/restaurant/custtypereport/index.html
@@ -9,6 +9,7 @@
     <div class="layui-card-body">
         <div class="layui-form" lay-filter="custtypereport-search-form">
             <input type="hidden" id="custtypereport-hidden-maxdate" th:value="${maxdate}" />
+            <input type="hidden" id="custtypereport-hidden-devgroupid" th:value="${devgroupid}"/>
             <div class="layui-form-item" style="margin-bottom: 0;">
                 <div class="layui-inline">
                     <label class="layui-form-label">记账日期</label>
@@ -139,7 +140,10 @@
                 return true;
             },
             success: function (d) {
-                console.log(d); // 加载完成后的回调函数
+                let limit= $("#custtypereport-hidden-devgroupid").val();
+                treeSelect.checkNode(
+                    'custtypereport-search-devgroup-filter',
+                    limit);
             }
         });
 
diff --git a/src/main/resources/templates/restaurant/report/laborcount.html b/src/main/resources/templates/restaurant/report/laborcount.html
index a1476fd..1e88907 100644
--- a/src/main/resources/templates/restaurant/report/laborcount.html
+++ b/src/main/resources/templates/restaurant/report/laborcount.html
@@ -9,6 +9,7 @@
     <div class="layui-card-body">
         <div class="layui-form" lay-filter="shopreport-labercount-search-form">
             <input type="hidden" id="shopreport-labercount-hidden-maxdate" th:value="${maxdate}"/>
+            <input type="hidden" id="shopreport-labercount-hidden-devgroupid" th:value="${devgroupid}"/>
             <input type="hidden" id="shopreport-labercount-hidden-maxmonth" th:value="${maxmonth}"/>
             <div class="layui-form-item" style="margin-bottom: 0;">
                 <div class="layui-inline">
@@ -205,7 +206,11 @@
                 return true;
             },
             success: function (d) {
-                console.log(d); // 加载完成后的回调函数
+                let limit= $("#shopreport-labercount-hidden-devgroupid").val();
+
+                treeSelect.checkNode(
+                    'labercount-search-devgroup-filter',
+                    limit);
             }
         });
 
diff --git a/src/main/resources/templates/restaurant/report/laborfee.html b/src/main/resources/templates/restaurant/report/laborfee.html
index 64e7aaf..5b6d4bc 100644
--- a/src/main/resources/templates/restaurant/report/laborfee.html
+++ b/src/main/resources/templates/restaurant/report/laborfee.html
@@ -9,6 +9,7 @@
     <div class="layui-card-body">
         <div class="layui-form" lay-filter="shopreport-laborfee-search-form">
             <input type="hidden" id="shopreport-laborfee-hidden-maxdate" th:value="${maxdate}"/>
+            <input type="hidden" id="shopreport-laborfee-hidden-devgroupid" th:value="${devgroupid}"/>
             <input type="hidden" id="shopreport-laborfee-hidden-maxmonth" th:value="${maxmonth}"/>
             <div class="layui-form-item" style="margin-bottom: 0;">
                 <div class="layui-inline">
@@ -223,7 +224,11 @@
                 return true;
             },
             success: function (d) {
-                console.log(d); // 加载完成后的回调函数
+                let limit= $("#shopreport-laborfee-hidden-devgroupid").val();
+
+                treeSelect.checkNode(
+                    'laborfee-search-devgroup-filter',
+                    limit);
             }
         });
 
diff --git a/src/main/resources/templates/restaurant/termreport/index.html b/src/main/resources/templates/restaurant/termreport/index.html
new file mode 100644
index 0000000..653cb67
--- /dev/null
+++ b/src/main/resources/templates/restaurant/termreport/index.html
@@ -0,0 +1,252 @@
+<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="termreport-search-form">
+            <input type="hidden" id="termreport-hidden-maxdate" th:value="${maxdate}" />
+            <input type="hidden" id="termreport-hidden-devgroupid" th:value="${devgroupid}"/>
+            <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="termreport-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="termreport-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="groupid" id="termreport-search-devgroup" lay-filter="termreport-search-devgroup-filter"
+                               autocomplete="off" class="layui-input"/>
+                    </div>
+                </div>
+
+                <div class="layui-inline">
+                    <button id="termreport-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">
+        <div class="layui-form toolbar">
+            <div class="layui-btn-group">
+                <button id="shopreport-termreport-export-excel" class="layui-btn layui-btn-sm layui-btn-primary sw-print"><i class="layui-icon layui-icon-export"></i>导出</button>
+                <button id="shopreport-termreport-print-table" class="layui-btn layui-btn-sm layui-btn-primary sw-print"><i class="layui-icon layui-icon-print"></i>打印</button>
+            </div>
+        </div>
+        <table class="layui-table sw-table" id="shopreport-termreport-table" th:fragment="termreportTable">
+            <thead>
+            <tr>
+                <th rowspan="3" style="text-align: center;min-width: 60px;">序号</th>
+                <th rowspan="3" style="text-align: center;min-width: 100px;">食堂</th>
+                <th colspan="6" style="text-align: center;">含餐补消费支付</th>
+                <th colspan="3" style="text-align: center;">无餐补消费支付</th>
+                <th  rowspan="3" style="text-align: center;">消费金额</th>
+                <th  rowspan="3" style="text-align: center;">合计消费次数</th>
+            </tr>
+            <tr>
+                <th rowspan="2" style="text-align: center;min-width: 60px;">早餐<br/>金额</th>
+                <th rowspan="2" style="text-align: center;min-width: 60px;">早餐<br/>份数</th>
+                <th rowspan="2" style="text-align: center;min-width: 60px;">午餐<br/>金额</th>
+                <th rowspan="2" style="text-align: center;min-width: 60px;">午餐<br/>份数</th>
+                <th rowspan="2" style="text-align: center;min-width: 60px;">晚餐<br/>金额</th>
+                <th rowspan="2" style="text-align: center;min-width: 60px;">晚餐<br/>份数</th>
+                <!--<th rowspan="2" style="text-align: center;min-width: 60px;">正价金额<br/>小计</th>-->
+              <!--  <th rowspan="2" style="text-align: center;min-width: 60px;">早餐<br/>金额</th>-->
+                <th rowspan="2" style="text-align: center;min-width: 60px;">早餐<br/>份数</th>
+             <!--   <th rowspan="2" style="text-align: center;min-width: 60px;">午餐<br/>金额</th>-->
+                <th rowspan="2" style="text-align: center;min-width: 60px;">午餐<br/>份数</th>
+          <!--      <th rowspan="2" style="text-align: center;min-width: 60px;">晚餐<br/>金额</th>-->
+                <th rowspan="2" style="text-align: center;min-width: 60px;">晚餐<br/>份数</th>
+
+            </tr>
+            </thead>
+            <tbody id="shopreport-termreport-tbody" th:data-startdate="${searchBean.startdate}" th:data-enddate="${searchBean.enddate}"  th:data-opercode="${opercode}">
+            <tr th:if="${null==showlist || showlist.size()==0}">
+                <td colspan="13">无数据</td>
+            </tr>
+            <div th:remove="tag" th:if="${null!=showlist && showlist.size()>0}" th:each="data:${showlist}" >
+
+                <tr>
+                    <td style="font-weight: bold;" th:text="${data.rownum}"></td>
+                    <td style="font-weight: bold;" th:text="${data.groupname}"></td>
+                    <td style="font-weight: bold;" th:text="${#numbers.formatDecimal(data.ibtotalamt,1,2)}"></td>
+                    <td style="font-weight: bold;" th:text="${data.ibtotalcnt}"></td>
+                    <td style="font-weight: bold;" th:text="${#numbers.formatDecimal(data.iltotalamt,1,2)}"></td>
+                    <td style="font-weight: bold;" th:text="${data.iltotalcnt}"></td>
+                    <td style="font-weight: bold;" th:text="${#numbers.formatDecimal(data.idtotalamt,1,2)}"></td>
+                    <td style="font-weight: bold;" th:text="${data.idtotalcnt}"></td>
+               <!--     <td style="font-weight: bold;" th:text="${#numbers.formatDecimal(data.obtotalamt,1,2)}"></td>-->
+                    <td style="font-weight: bold;" th:text="${data.obtotalcnt}"></td>
+            <!--        <td style="font-weight: bold;" th:text="${#numbers.formatDecimal(data.oltotalamt,1,2)}"></td>-->
+                    <td style="font-weight: bold;" th:text="${data.oltotalcnt}"></td>
+                 <!--   <td style="font-weight: bold;" th:text="${#numbers.formatDecimal(data.odtotalamt,1,2)}"></td>-->
+                    <td style="font-weight: bold;" th:text="${data.odtotalcnt}"></td>
+                    <td style="font-weight: bold;" th:text="${#numbers.formatDecimal(data.ibtotalamt+data.iltotalamt+data.idtotalamt,1,2)}"></td>
+                    <td style="font-weight: bold;" th:text="${data.ibtotalcnt+data.iltotalcnt+data.idtotalcnt+data.obtotalcnt+data.oltotalcnt+data.odtotalcnt}"></td>
+
+                </tr>
+            </div>
+            </tbody>
+        </table>
+    </div>
+</div>
+
+
+<script>
+    layui.use(['form', 'layer',  'element', 'laydate','treeSelect'], function () {
+        var laydate = layui.laydate;
+        var layer = layui.layer;
+        var $ = layui.jquery;
+        var treeSelect = layui.treeSelect;
+
+        treeSelect.render({
+            elem: '#termreport-search-devgroup',
+            data: '[[@{/whitelistbind/devgrouptree}]]',
+            type: 'get',
+            placeholder: '选择设备组',
+            search: false,
+            style: {
+                folder: {
+                    enable: false
+                },
+                line: {
+                    enable: true
+                }
+            },
+            // 点击回调
+            click: function (d) {
+                var treeNode = d.current;
+                console.log(treeNode);
+                if(treeNode.grouptype == 'branch'){
+                    layer.msg("请选择末级商户", {icon: 2, time:1500});
+                    $("#dailyreport-search-devgroup").val("");
+                    treeSelect.revokeNode('termreport-search-devgroup-filter');
+                    return false;
+                }
+                return true;
+            },
+            success: function (d) {
+                let limit= $("#termreport-hidden-devgroupid").val();
+                treeSelect.checkNode(
+                    'termreport-search-devgroup-filter',
+                    limit);
+            }
+        });
+
+
+        laydate.render({
+            elem: '#termreport-search-startdate',
+            max: $("#termreport-hidden-maxdate").val(),
+            trigger: 'click'
+        });
+        laydate.render({
+            elem: '#termreport-search-enddate',
+            max: $("#termreport-hidden-maxdate").val(),
+            trigger: 'click'
+        });
+
+        $('#termreport-search-btn').click(function () {
+            var startdate = $("#termreport-search-startdate").val();
+            var enddate = $("#termreport-search-enddate").val();
+            var groupid = $("#termreport-search-devgroup").val();
+            if (null == startdate || "" == $.trim(startdate)) {
+                layer.msg('请选择起始日期', {icon: 2, time: 1500});
+                return;
+            }
+            if (null == enddate || "" == $.trim(enddate)) {
+                layer.msg('请选择截止日期', {icon: 2, time: 1500});
+                return;
+            }
+
+            $.ajax({
+                url: '[[@{/termreport/termreportlist}]]',
+                type: "POST",
+                data: {
+                    startdate: startdate,
+                    enddate: enddate,
+                    groupid: groupid,
+                    _csrf: $("meta[name='_csrf_token']").attr("value")
+                },
+                success: function (data) {
+                    $("#shopreport-termreport-table").html(data);
+                    layer.closeAll('loading');
+                },
+                error: function (status, err) {
+                    layer.closeAll('loading');
+                    layer.msg('查询失败了', {icon: 2});
+                }
+            });
+        });
+
+        $("#shopreport-termreport-export-excel").click(function(){
+            var startdate= $("#shopreport-termreport-tbody").attr("data-startdate");
+            var enddate= $("#shopreport-termreport-tbody").attr("data-enddate");
+            var groupid = $("#termreport-search-devgroup").val();
+
+            var dataUrl='[[@{/termreport/excelexport}]]?startdate='+startdate+'&enddate='+enddate+'&groupid='+groupid;
+            var xhr = new XMLHttpRequest();
+            xhr.responseType = "blob"; //设置响应类型为blob类型
+            xhr.onload = function () {
+                debugger
+                if (this.status == "200") {
+                    //获取响应文件流 
+                    var blob = this.response;
+                    // 转换完成,创建一个a标签用于下载
+                    var aElem = document.createElement('a');
+                    aElem.href = window.URL.createObjectURL(blob);
+                    aElem.download = "客户类别消费报表.xls";
+                    aElem.onload = function (e) {
+                        window.URL.revokeObjectURL(aElem.href);
+                    };
+                    $("body").append(aElem);  // 修复firefox中无法触发click
+                    aElem.click();
+                    $(aElem).remove();
+
+                }else if(this.status == "403"){
+                    layer.msg('无导出资源权限', {icon: 2});
+                } else {
+                    layer.msg('导出excel失败了', {icon: 2});
+                }
+            }
+            xhr.open("GET", dataUrl, true);
+            xhr.send();
+        });
+
+        var LODOP; //声明为全局变量
+        $("#shopreport-termreport-print-table").click(function(){
+            var startdate= $("#shopreport-termreport-tbody").attr("data-startdate");
+            var enddate= $("#shopreport-termreport-tbody").attr("data-enddate");
+            var groupid = $("#termreport-search-devgroup").val();
+
+            var opercode = $("#shopreport-termreport-tbody").attr("data-opercode");
+            var url = '/termreport/print/printtermreport?startdate=' + startdate + '&enddate=' + enddate +'&groupid=' + groupid+  '&opercode=' + opercode;
+
+            LODOP = getLodop();
+            LODOP.PRINT_INIT("客户类别消费报表");
+            LODOP.SET_PRINT_PAGESIZE(2, 0, 0,"A4");
+            LODOP.ADD_PRINT_URL(30, 20, "95%", "90%", encodeURI(url));
+            LODOP.ADD_PRINT_HTM("95%", "48%", 150, 50, "<font style='font-size:12px'><span tdata='pageNO'>##</span>/<span tdata='pageCount'>&nbsp;&nbsp;##</span></font>");
+            LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
+            LODOP.SET_PRINT_STYLEA(0, "HOrient", 3);
+            LODOP.SET_PRINT_STYLEA(0, "VOrient", 3);
+            LODOP.SET_SHOW_MODE("NP_NO_RESULT", true);
+            LODOP.SET_PRINT_MODE("FULL_WIDTH_FOR_OVERFLOW",true);
+            LODOP.PREVIEW();
+        });
+
+    });
+</script>
\ No newline at end of file
diff --git a/src/main/resources/templates/restaurant/termreport/print/printcusttypereport.html b/src/main/resources/templates/restaurant/termreport/print/printcusttypereport.html
new file mode 100644
index 0000000..db3c0b2
--- /dev/null
+++ b/src/main/resources/templates/restaurant/termreport/print/printcusttypereport.html
@@ -0,0 +1,110 @@
+<!DOCTYPE html>
+<html xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
+<head>
+    <meta charset="UTF-8">
+    <title>人员类别消费表</title>
+
+    <link rel="stylesheet" th:href="@{/static/libs/layui/css/layui.css}"/>
+    <link rel="stylesheet" th:href="@{/static/custom/css/custom.css}"/>
+</head>
+<body>
+<div class="layui-card">
+    <div class="layui-card-header" style="text-align: center;">
+        <h1>人员类别消费表</h1>
+    </div>
+    <div class="layui-card-body">
+        <div class="layui-form toolbar">
+            <div style="float: left;padding-left: 3px;" th:text="${'区间:'+period}"></div>
+            <div style="float: right;" th:text="'单位:元'"></div>
+        </div>
+        <table class="layui-table sw-table sw-print">
+            <thead>
+            <tr>
+                <th rowspan="3" style="text-align: center;min-width: 60px;">序号<br/> <br/> </th>
+                <th rowspan="3" style="text-align: center;min-width: 160px;">食堂<br/> <br/> </th>
+                <th colspan="6" style="text-align: center;">含餐补消费支付</th>
+                <th colspan="6" style="text-align: center;">无餐补消费支付</th>
+                <th  rowspan="3" style="text-align: center;min-width: 60px;">合计<br/>消费<br/>金额</th>
+                <th  rowspan="3" style="text-align: center;min-width: 60px;">合计<br/>消费<br/>次数</th>
+            </tr>
+            <tr>
+                <th rowspan="2" style="text-align: center;min-width: 60px;">早餐<br/>金额</th>
+                <th rowspan="2" style="text-align: center;min-width: 60px;">早餐<br/>份数</th>
+                <th rowspan="2" style="text-align: center;min-width: 60px;">午餐<br/>金额</th>
+                <th rowspan="2" style="text-align: center;min-width: 60px;">午餐<br/>份数</th>
+                <th rowspan="2" style="text-align: center;min-width: 60px;">晚餐<br/>金额</th>
+                <th rowspan="2" style="text-align: center;min-width: 60px;">晚餐<br/>份数</th>
+              <!--  <th rowspan="2" style="text-align: center;min-width: 60px;">早餐<br/>金额</th>-->
+                <th rowspan="2" style="text-align: center;min-width: 60px;">早餐<br/>份数</th>
+             <!--   <th rowspan="2" style="text-align: center;min-width: 60px;">午餐<br/>金额</th>-->
+                <th rowspan="2" style="text-align: center;min-width: 60px;">午餐<br/>份数</th>
+              <!--  <th rowspan="2" style="text-align: center;min-width: 60px;">晚餐<br/>金额</th>-->
+                <th rowspan="2" style="text-align: center;min-width: 60px;">晚餐<br/>份数</th>
+
+            </tr>
+            </thead>
+            <tbody>
+            <tr th:if="${null==showlist || showlist.size()==0}">
+                <td colspan="16">无数据</td>
+            </tr>
+            <div th:remove="tag" th:if="${null!=showlist && showlist.size()>0}" th:each="data:${showlist}" >
+
+                <tr>
+                    <td style="font-weight: bold;" th:text="${data.rownum}"></td>
+                    <td style="font-weight: bold;" th:text="${data.groupname}"></td>
+                    <td style="font-weight: bold;" th:text="${#numbers.formatDecimal(data.ibtotalamt,1,2)}"></td>
+                    <td style="font-weight: bold;" th:text="${data.ibtotalcnt}"></td>
+                    <td style="font-weight: bold;" th:text="${#numbers.formatDecimal(data.iltotalamt,1,2)}"></td>
+                    <td style="font-weight: bold;" th:text="${data.iltotalcnt}"></td>
+                    <td style="font-weight: bold;" th:text="${#numbers.formatDecimal(data.idtotalamt,1,2)}"></td>
+                    <td style="font-weight: bold;" th:text="${data.idtotalcnt}"></td>
+                  <!--  <td style="font-weight: bold;" th:text="${#numbers.formatDecimal(data.obtotalamt,1,2)}"></td>-->
+                    <td style="font-weight: bold;" th:text="${data.obtotalcnt}"></td>
+                 <!--   <td style="font-weight: bold;" th:text="${#numbers.formatDecimal(data.oltotalamt,1,2)}"></td>-->
+                    <td style="font-weight: bold;" th:text="${data.oltotalcnt}"></td>
+                  <!--  <td style="font-weight: bold;" th:text="${#numbers.formatDecimal(data.odtotalamt,1,2)}"></td>-->
+                    <td style="font-weight: bold;" th:text="${data.odtotalcnt}"></td>
+                    <td style="font-weight: bold;" th:text="${#numbers.formatDecimal(data.ibtotalamt+data.iltotalamt+data.idtotalamt,1,2)}"></td>
+                    <td style="font-weight: bold;" th:text="${data.ibtotalcnt+data.iltotalcnt+data.idtotalcnt+data.obtotalcnt+data.oltotalcnt+data.odtotalcnt}"></td>
+
+                </tr>
+            </div>
+            </tbody>
+        </table>
+        <div class="layui-form toolbar">
+            <div style="float: left;padding-left: 3px;" th:text="${'制表人:'+opername+' &nbsp;&nbsp; '+ printdatetime}"></div>
+        </div>
+    </div>
+    <div class="layui-card-body" style="margin-top: 25px;">
+        <table class="sw-print-sign">
+            <tr>
+                <td width="50%">大理州公安局警务保障处审核盖章:</td>
+                <td width="50%">苍山饭店审核盖章:</td>
+            </tr>
+            <tr>
+                <td>经办人:</td>
+                <td>审核人:</td>
+            </tr>
+            <tr>
+                <td>审核人:</td>
+
+            </tr>
+            <tr>
+                <td colspan="2">&nbsp;</td>
+            </tr>
+            <tr>
+                <td colspan="2">&nbsp;</td>
+            </tr>
+            <!--            <tr>-->
+            <!--                <td>市民卡公司审核盖章:</td>-->
+            <!--                <td>建桥园审核盖章:</td>-->
+            <!--            </tr>-->
+            <!--            <tr>-->
+            <!--                <td>审核人:</td>-->
+            <!--                <td>审核人:</td>-->
+            <!--            </tr>-->
+        </table>
+    </div>
+</div>
+</body>
+</html>
\ No newline at end of file
diff --git a/src/main/resources/templates/restaurant/transdtl/indexview.html b/src/main/resources/templates/restaurant/transdtl/indexview.html
new file mode 100644
index 0000000..c0d4651
--- /dev/null
+++ b/src/main/resources/templates/restaurant/transdtl/indexview.html
@@ -0,0 +1,245 @@
+<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">
+            <form id="vtransdtl-form"  >
+                <div class="layui-form-item">
+                    <div class="layui-inline">
+                        <label class="layui-form-label">起始日期:</label>
+                        <div class="layui-input-inline">
+                            <input type="text" name="startdate" class="layui-input" th:value="${startDate}"
+                                   id="vtransdtl-startdate" placeholder="yyyy-MM-dd">
+                        </div>
+
+                    </div>
+                    <div class="layui-inline">
+                        <label class="layui-form-label">结束日期:</label>
+                        <div class="layui-input-inline">
+                            <input type="text" name="enddate" class="layui-input" th:value="${endDate}"
+                                   id="vtransdtl-enddate" placeholder="yyyy-MM-dd">
+                        </div>
+                    </div>
+                    <div class="layui-inline">
+                        <label class="layui-form-label"> 姓名:</label>
+                        <div class="layui-input-inline">
+                            <input id="vtransdtl-custname" name="custname" class="layui-input" type="text"/>
+                        </div>
+                    </div>
+                </div>
+                <div class="layui-form-item">
+
+                    <div class="layui-inline">
+                        <label class="layui-form-label"> 交易号:</label>
+                        <div class="layui-input-inline">
+                            <input id="vtransdtl-refno" name="billno" class="layui-input " type="text"/>
+                        </div>
+                    </div>
+                    <div class="layui-inline">
+                        <label class="layui-form-label">终端号:</label>
+                        <div class="layui-input-inline">
+                            <input id="vtransdtl-termid" name="termid" class="layui-input " type="text"/>
+                        </div>
+                    </div>
+
+                </div>
+
+                <div class="layui-form-item">
+
+                    <div class="layui-inline" style="margin-left:5%">
+                        <button id="vtransdtl-btn-search" class="layui-btn icon-btn" data-type="search">
+                            <i class="layui-icon">&#xe615;</i>搜索
+                        </button>
+                        <button id="vtransdtl-btn-reset" class="layui-btn layui-btn-primary">重置
+                        </button>
+                        <!--    <button id="btn-export"  lay-filter="form-submit" lay-submit  class="layui-btn layui-btn-primary">导出
+                            </button>-->
+                        <a id="vtransdtl-btn-export" href="javascript:void(0);" class="layui-btn layui-btn-primary" >导出</a>
+                    </div>
+                </div>
+
+            </form>
+
+        </div>
+        <table class="layui-table" id="vtransdtl-table" lay-filter="table"></table>
+    </div>
+</div>
+<input hidden th:value="${shopList}" id="vtransdtl-shoplist">
+<script>
+
+    var rawlist = $("#vtransdtl-shoplist").val();
+    var shoplist = JSON.parse(rawlist);
+
+    layui.use(['form', 'table', 'layer', 'admin', 'element', 'laydate'], function () {
+        let form = layui.form;
+        let table = layui.table;
+        let admin = layui.admin;
+
+        var enddate = $("#vtransdtl-enddate").val();
+        var startdate=$("#vtransdtl-startdate").val();
+
+        form.render('select');
+        var laydate = layui.laydate;
+        laydate.render({
+            elem: '#vtransdtl-startdate',
+            btns: ['now', 'confirm'],
+            trigger: 'click',
+            max: enddate
+        });
+        laydate.render({
+            elem: '#vtransdtl-enddate',
+            btns: ['now', 'confirm'],
+            trigger: 'click',
+            max: enddate
+        });
+
+        // 渲染表格
+        table.render({
+            elem: '#vtransdtl-table',
+            url: '[[@{/transdtl/listview}]]',
+            where:{
+                startdate:startdate,
+                enddate:enddate
+            },
+            toolbar: true,
+            defaultToolbar: ['filter', 'print'],
+            page: true,
+            cols: [
+                [
+                    {field: 'bankcardno', title: '银行卡号',width:200, fixed: 'left'},
+                    {field: 'custname', title: '姓名',width:100, fixed: 'left'},
+                    {field: 'billno', title: '系统交易号', fixed: 'left',width:200, sort: true},
+                    {field: 'amount', title: '交易金额',width:100, sort: true,
+                        templet: function (item) {
+                            return parseFloat(item.amount).toFixed(2);
+                        }},
+                    {
+                        field: 'transdate',
+                        title: '交易日期',
+                        sort: true,
+                        width:120,
+                        templet: function (item) {
+                            var date = item.transdate;
+                            if (date != null) {
+                                return date.substr(0, 4) + '-' + date.substr(4, 2) + '-' + date.substr(6, 2);
+                            }
+                            return '';
+                        }
+                    },
+                    {
+                        field: 'transtime',
+                        title: '交易时间',
+                        sort: true,
+                        width:100,
+                        templet: function (item) {
+                            var time = item.transtime;
+                            if (time != null) {
+                                return time.substr(0, 2) + ':' + time.substr(2, 2) + ':' + time.substr(4, 2);
+                            }
+                            return '';
+                        }
+                    },
+                    {field: 'tradeno', title: '核心跟踪号',width:120},
+                    {field: 'authno', title: '授权码',width:120},
+                    {field: 'rulename', title: '交易折扣',width:120},
+                    {field: 'deptname', title: '所属单位',width:120},
+                    {field: 'shopname', title: '商户名称',width:120},
+                    {field: 'searchno', title: '检索参考号',width:120},
+                    {field: 'serviceamt', title: '手续费',width:120},
+                    {field: 'shopid', title: '商户号',width:120},
+                    {field: 'shopname', title: '商户名称',width:120},
+                    {field: 'revertamt', title: '退货金额',width:120},
+                    {field: 'revertamt', title: '退货金额',width:120},
+                    {field: 'revbillno', title: '原系统流水号',width:120},
+                    {field: 'shopname', title: '商户名称',width:120},
+                    {field: 'termid',width:100, title: '终端号', sort: true},
+                    {
+                        field: 'status',
+                        title: '交易标志',
+                        width:100,
+                        align: 'center',
+                        templet: function (item) {
+                            return getTempDictValue('transtatusList',item.status);
+                        }
+                    },
+                    {
+                        field: 'status',
+                        title: '应答码',
+                        width:100,
+                        align: 'center',
+                        templet: function (item) {
+                            return getTempDictValue('transtatusList',item.status);
+                        }
+                    },
+                    {
+                        field: 'transtype',
+                        title: '流水类型',
+                        width:100,
+                        sort: true,
+                        align: 'center',
+                        templet: function (item) {
+                            return getTempDictValue('transtypeList',item.transtype);
+                        }
+                    },
+                    {field: 'revertamt', title: '退货金额', width:100},
+                    {field: 'cleartype', title: '清算类别', width:100},
+                    {field: 'servicetype', title: '业务类别', width:100},
+                ]
+            ]
+        });
+        $('#vtransdtl-btn-export').click(function () {
+            var url = '[[@{/transdtl/exportview}]]';
+            /* $("#form").attr("action",url);
+
+             $("#form").submit();*/
+            var param = $("#vtransdtl-form").serialize();
+
+            $("#vtransdtl-btn-export").attr("href", url + "?" + param);
+            $("#vtransdtl-btn-export")[0].click();
+        });
+        // 搜索按钮点击事件
+        $('#vtransdtl-btn-search').click(function () {
+            let custname = $('#vtransdtl-custname').val().trim();
+        //    let shopid = $('#vtransdtl-shopid').val().trim();
+            let startdate = $('#vtransdtl-startdate').val();
+            let enddate = $('#vtransdtl-enddate').val();
+            let refno = $('#vtransdtl-refno').val().trim();
+        //    let status = $('#vtransdtl-status').val();
+            let termid = $('#vtransdtl-termid').val().trim();
+            table.reload('vtransdtl-table', {
+                where: {
+                    custname: custname,
+             //       shopid: shopid,
+                    startdate: startdate,
+                    enddate: enddate,
+                    billno: refno,
+              //      status: status,
+                    termid: termid
+                }, page: {curr: 1}
+            });
+            //页面存在form需要返回false,否则layui自动刷新
+            return false;
+
+
+        });
+
+        $('#vtransdtl-btn-reset').click(function () {
+            $(".layui-input").val("");
+            $("select").val("");
+            $("#vtransdtl-startdate").val(startdate);
+            $("#vtransdtl-enddate").val(enddate);
+            return false;
+
+        });
+
+    });
+
+
+    // 工具条点击事件
+
+</script>
diff --git a/src/main/resources/templates/system/operator/index.html b/src/main/resources/templates/system/operator/index.html
index 6cbcf98..7531ec8 100644
--- a/src/main/resources/templates/system/operator/index.html
+++ b/src/main/resources/templates/system/operator/index.html
@@ -42,6 +42,7 @@
 <script type="text/html" id="oper-table-bar">
     <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="edit">修改</a>
     <a class="layui-btn layui-btn-xs" lay-event="resetpwd">重置密码</a>
+    <a class="layui-btn layui-btn-xs" lay-event="setauth">设置查询权限</a>
 </script>
 
 <script>
@@ -76,8 +77,8 @@
                             }
                         }
                     },
-                    {field: 'mobile', sort: true, title: '手机号'},
-                    {field: 'email', sort: true, title: '电子邮箱'},
+                    {field: 'mobile', sort: true,width: 140, title: '手机号'},
+                 /*   {field: 'email', sort: true, title: '电子邮箱'},*/
                     {field: 'opendate', sort: true, width: 120, title: '注册日期'},
                     {align: 'center', toolbar: '#oper-table-bar', title: '操作', fixed: 'right'}
                 ]
@@ -168,6 +169,16 @@
                         layer.msg('请求失败了,请稍后再试', {icon: 2});
                     });
                 });
+            } else if (layEvent === 'setauth') { //
+                let title = '查询权限分配';
+                admin.putTempData('t_user', data);
+                admin.popupCenter({
+                    title: title,
+                    path: '[[@{/operator/getquerylimit}]]'+'?opercode='+data.opercode,
+                    finish: function () {
+                        table.reload('oper-table', {});
+                    }
+                });
             }
         });
 
diff --git a/src/main/resources/templates/system/operator/limitform.html b/src/main/resources/templates/system/operator/limitform.html
new file mode 100644
index 0000000..ccce8b8
--- /dev/null
+++ b/src/main/resources/templates/system/operator/limitform.html
@@ -0,0 +1,110 @@
+
+<form id="form" lay-filter="form" class="layui-form model-form">
+    <input name="opercode" id="querylimit-id" type="hidden"/>
+    <div class="layui-form-item">
+        <label class="layui-form-label"><span style="color: red">* </span>名称</label>
+        <div class="layui-input-block">
+            <input disabled name="opername" placeholder="" type="text" class="layui-input" maxlength="20"
+                   lay-verify="required|devphyid" required/>
+        </div>
+    </div>
+    <div class="layui-form-item">
+        <label class="layui-form-label"><span style="color: red">* </span>权限</label>
+        <div class="layui-input-block">
+            <input id="search-querylimit-form-devgroupid" type="text" name="devgroupid"
+                   lay-filter="search-querylimit-form-devgroupid-filter" autocomplete="off"
+                   class="layui-input"/>
+        </div>
+
+    </div>
+    <input type="hidden" id="updatelimit-form-limit" th:value="${limit}" />
+
+    <div class="layui-form-item model-form-footer">
+        <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
+        <button class="layui-btn" lay-filter="updatelimit-form-submit" lay-submit id="submitbtn">保存</button>
+    </div>
+</form>
+
+<script>
+    layui.use(['layer', 'admin', 'form', 'formSelects','treeSelect'], function () {
+        var layer = layui.layer;
+        var admin = layui.admin;
+        var form = layui.form;
+        var treeSelect = layui.treeSelect;
+        form.render('select');
+        form.render('radio');
+
+        treeSelect.render({
+            elem: '#search-querylimit-form-devgroupid',
+            data: '[[@{/device/binddevparagrouptree}]]',
+            type: 'get',
+            placeholder: '选择设备组',
+            search: false,
+            style: {
+                folder: {
+                    enable: false
+                },
+                line: {
+                    enable: true
+                }
+            },
+            // 点击回调
+            click: function (d) {
+                var treeNode = d.current;
+                return true;
+            },
+            success: function (d) {
+                let limit= $("#updatelimit-form-limit").val();
+
+                treeSelect.checkNode(
+                    'search-querylimit-form-devgroupid-filter',
+                    limit);
+            }
+        });
+
+        var url = '[[@{/operator/updatelimit}]]';
+
+        // 回显user数据
+        var dev = admin.getTempData('t_user');
+        if (dev) {
+             $('input[name="opercode"]').attr('readonly', 'readonly');
+            form.val('form', dev);
+        }
+
+        form.on('submit(updatelimit-form-submit)', function (data) {
+            console.log(data.field);
+            layer.load(2);
+            let token = $("meta[name='_csrf_token']").attr("value");
+            $.ajax({
+                type: "POST",
+                dataType: "json",
+                url: url,
+                headers: {
+                    'Accept': 'application/json',
+                    'Content-Type': 'application/json',
+                    'X-CSRF-TOKEN': token,
+                },
+                data: JSON.stringify(data.field),
+                success: function (result) {
+                    layer.closeAll('loading');
+                    if (result.code == 200) {
+                        layer.msg(result.msg, {icon: 1});
+                        admin.finishPopupCenter();
+                    } else if (result.code == 401) {
+                        layer.msg(result.msg, {icon: 2, time: 1500}, function () {
+                            location.replace('/login');
+                        }, 1000);
+                        return;
+                    } else {
+                        layer.msg(result.msg, {icon: 2});
+                    }
+                },
+                error: function () {
+                    layer.closeAll('loading');
+                    layer.msg("请求服务器失败!", {icon: 2});
+                }
+            });
+            return false;
+        });
+    });
+</script>
\ No newline at end of file