客户类别报表提交
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/bean/CusttypeReportShowBean.java b/src/main/java/com/supwisdom/dlpay/restaurant/bean/CusttypeReportShowBean.java
new file mode 100644
index 0000000..a365df8
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/bean/CusttypeReportShowBean.java
@@ -0,0 +1,155 @@
+package com.supwisdom.dlpay.restaurant.bean;
+
+
+public class CusttypeReportShowBean {
+  private String groupname;
+  private Integer rownum; //行号
+
+  //内部
+  private Double ibtotalamt; //早餐总金额
+  private Integer ibtotalcnt;//早餐份数
+  private Double iltotalamt; //午餐总金额
+  private Integer iltotalcnt;//午餐份数
+  private Double idtotalamt; //晚餐总金额
+  private Integer idtotalcnt;//晚餐份数
+
+  //外部
+  private Double obtotalamt; //早餐总金额
+  private Integer obtotalcnt;//早餐份数
+  private Double oltotalamt; //午餐总金额
+  private Integer oltotalcnt;//午餐份数
+  private Double odtotalamt; //晚餐总金额
+  private Integer odtotalcnt;//晚餐份数
+
+  private Integer sumcnt;
+  private Double sumamt;
+
+  public String getGroupname() {
+    return groupname;
+  }
+
+  public void setGroupname(String groupname) {
+    this.groupname = groupname;
+  }
+
+  public Integer getRownum() {
+    return rownum;
+  }
+
+  public void setRownum(Integer rownum) {
+    this.rownum = rownum;
+  }
+
+  public Double getIbtotalamt() {
+    return ibtotalamt;
+  }
+
+  public void setIbtotalamt(Double ibtotalamt) {
+    this.ibtotalamt = ibtotalamt;
+  }
+
+  public Integer getIbtotalcnt() {
+    return ibtotalcnt;
+  }
+
+  public void setIbtotalcnt(Integer ibtotalcnt) {
+    this.ibtotalcnt = ibtotalcnt;
+  }
+
+  public Double getIltotalamt() {
+    return iltotalamt;
+  }
+
+  public void setIltotalamt(Double iltotalamt) {
+    this.iltotalamt = iltotalamt;
+  }
+
+  public Integer getIltotalcnt() {
+    return iltotalcnt;
+  }
+
+  public void setIltotalcnt(Integer iltotalcnt) {
+    this.iltotalcnt = iltotalcnt;
+  }
+
+  public Double getIdtotalamt() {
+    return idtotalamt;
+  }
+
+  public void setIdtotalamt(Double idtotalamt) {
+    this.idtotalamt = idtotalamt;
+  }
+
+  public Integer getIdtotalcnt() {
+    return idtotalcnt;
+  }
+
+  public void setIdtotalcnt(Integer idtotalcnt) {
+    this.idtotalcnt = idtotalcnt;
+  }
+
+  public Double getObtotalamt() {
+    return obtotalamt;
+  }
+
+  public void setObtotalamt(Double obtotalamt) {
+    this.obtotalamt = obtotalamt;
+  }
+
+  public Integer getObtotalcnt() {
+    return obtotalcnt;
+  }
+
+  public void setObtotalcnt(Integer obtotalcnt) {
+    this.obtotalcnt = obtotalcnt;
+  }
+
+  public Double getOltotalamt() {
+    return oltotalamt;
+  }
+
+  public void setOltotalamt(Double oltotalamt) {
+    this.oltotalamt = oltotalamt;
+  }
+
+  public Integer getOltotalcnt() {
+    return oltotalcnt;
+  }
+
+  public void setOltotalcnt(Integer oltotalcnt) {
+    this.oltotalcnt = oltotalcnt;
+  }
+
+  public Double getOdtotalamt() {
+    return odtotalamt;
+  }
+
+  public void setOdtotalamt(Double odtotalamt) {
+    this.odtotalamt = odtotalamt;
+  }
+
+  public Integer getOdtotalcnt() {
+    return odtotalcnt;
+  }
+
+  public void setOdtotalcnt(Integer odtotalcnt) {
+    this.odtotalcnt = odtotalcnt;
+  }
+
+  public Integer getSumcnt() {
+    return sumcnt;
+  }
+
+  public void setSumcnt(Integer sumcnt) {
+    this.sumcnt = sumcnt;
+  }
+
+  public Double getSumamt() {
+    return sumamt;
+  }
+
+  public void setSumamt(Double sumamt) {
+    this.sumamt = sumamt;
+  }
+
+}
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 4b7e38f..8675c60 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/controller/CusttypeReportController.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/controller/CusttypeReportController.java
@@ -4,12 +4,12 @@
 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.CusttypeReportShowBean;
 import com.supwisdom.dlpay.restaurant.bean.DailyReportSearchBean;
 import com.supwisdom.dlpay.restaurant.bean.DailyReportShowBean;
-import com.supwisdom.dlpay.restaurant.service.DailyReportService;
+import com.supwisdom.dlpay.restaurant.service.CusttypeReportService;
 import com.supwisdom.dlpay.restaurant.service.StatementReportService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.security.core.annotation.AuthenticationPrincipal;
 import org.springframework.security.core.userdetails.UserDetails;
 import org.springframework.stereotype.Controller;
@@ -30,7 +30,7 @@
     @Autowired
     private SystemUtilService systemUtilService;
     @Autowired
-    private DailyReportService dailyReportService;
+    private CusttypeReportService custtypeReportService;
     @Autowired
     private StatementReportService statementReportService;
 
@@ -44,18 +44,17 @@
         String maxdate = DateUtil.reformatDatetime(settledate, "yyyyMMdd", "yyyy-MM-dd");
         searchBean.setStartdate(settledate);
         searchBean.setEnddate(settledate);
-        searchBean.setGroupid(0);
-        model.addAttribute("showlist", dailyReportService.getDailyReportSearchData(searchBean));
+        model.addAttribute("showlist", custtypeReportService.getCusttypeReportSearchData(searchBean));
 
         model.addAttribute("maxdate", maxdate);
 
         TOperator oper = (TOperator) operUser;
         model.addAttribute("opercode", oper == null ? "unknow" : oper.getOpercode());
-        return "restaurant/deptreport/index";
+        return "restaurant/custtypereport/index";
     }
 
-    @RequestMapping("/deptreportlist")
-    @PreAuthorize("hasPermission('/deptreport/deptreportlist','')")
+    @RequestMapping("/custtypereportlist")
+ //   @PreAuthorize("hasPermission('/deptreport/deptreportlist','')")
     public String getDataList(
             @ModelAttribute("searchBean") DailyReportSearchBean searchBean,
             @AuthenticationPrincipal UserDetails operUser,
@@ -65,45 +64,45 @@
             TOperator oper = (TOperator) operUser;
             map.addAttribute("opercode", oper == null ? "unknow" : oper.getOpercode());
 
-            List<DailyReportShowBean> bean = dailyReportService.getDailyReportSearchData(searchBean);
+            List<CusttypeReportShowBean> bean = custtypeReportService.getCusttypeReportSearchData(searchBean);
 
             map.addAttribute("showlist",bean);
 
         } catch (Exception e) {
             e.printStackTrace();
         }
-        return "restaurant/deptreport/index::deptreportTable";
+        return "restaurant/custtypereport/index::custtypereportTable";
     }
 
-    @GetMapping("/excelexportdeptreport")
-    public void excelExportDeptfee(@ModelAttribute("searchBean") DailyReportSearchBean searchBean,
+    @GetMapping("/excelexport")
+    public void excelExport(@ModelAttribute("searchBean") DailyReportSearchBean searchBean,
                                     @AuthenticationPrincipal UserDetails operUser,
                                     HttpServletRequest request, HttpServletResponse response, ModelMap map){
         try {
-            List<DailyReportShowBean> datalist = dailyReportService.getDailyReportSearchData(searchBean);
+            List<CusttypeReportShowBean> datalist = custtypeReportService.getCusttypeReportSearchData(searchBean);
             TOperator oper = (TOperator) operUser;
-            String filename="食堂日结报表";
-            dailyReportService.doCreateDailyReportExcel(response, datalist, searchBean, filename, oper);
+            String filename="客户类别消费报表";
+            custtypeReportService.doCreateCusttypeReportExcel(response, datalist, searchBean, filename, oper);
         } catch (Exception e) {
             e.printStackTrace();
         }
     }
 
 
-    @GetMapping("/print/printdeptreport")
-    public String printLaborfee(@ModelAttribute("searchBean") DailyReportSearchBean searchBean,
+    @GetMapping("/print/printcusttypereport")
+    public String print(@ModelAttribute("searchBean") DailyReportSearchBean searchBean,
                                 @RequestParam(value = "opercode",required = false) String opercode, ModelMap map) {
         try {
-            map.addAttribute("showlist", dailyReportService.getDailyReportSearchData(searchBean));
+            map.addAttribute("showlist", custtypeReportService.getCusttypeReportSearchData(searchBean));
 
             TOperator oper = statementReportService.getOperatorByOpercode(opercode);
             map.addAttribute("opername", oper == null ? "unknow" : oper.getOpername());
-            map.addAttribute("period", dailyReportService.getDailyReportSearchPeriod(searchBean));
+            map.addAttribute("period", custtypeReportService.getCusttypeReportSearchPeriod(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/deptreport/print/printdeptreport";
+        return "restaurant/custtypereport/print/printcusttypereport";
     }
 
 
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/controller/DeviceDiscountRuleController.java b/src/main/java/com/supwisdom/dlpay/restaurant/controller/DeviceDiscountRuleController.java
index 46c5cd6..15a8a81 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/controller/DeviceDiscountRuleController.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/controller/DeviceDiscountRuleController.java
@@ -2,6 +2,7 @@
 
 import com.supwisdom.dlpay.api.bean.JsonResult;
 import com.supwisdom.dlpay.exception.WebCheckException;
+import com.supwisdom.dlpay.framework.domain.TApiClient;
 import com.supwisdom.dlpay.framework.domain.TOperator;
 import com.supwisdom.dlpay.framework.util.*;
 import com.supwisdom.dlpay.restaurant.bean.*;
@@ -57,6 +58,25 @@
         }
     }
 
+    @PostMapping("/discountrule/changelimit")
+    @ResponseBody
+    public JsonResult changeLimit(@RequestParam("ruleid") Integer ruleid,
+                                            @RequestParam(value = "limitcnt", required = false) Integer limitcnt) {
+        if (null==ruleid && null==limitcnt) {
+            return JsonResult.error("参数传递错误");
+        }
+        try {
+            if(deviceDiscountRuleService.changeDiscountRuleLimitCnt(ruleid,limitcnt)){
+                return JsonResult.ok("修改次数成功");
+            }else {
+                return JsonResult.error("修改失败!");
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            return JsonResult.error("系统处理异常").put("exception", e);
+        }
+    }
+
     @PostMapping("/discountrule/deleterule")
     @PreAuthorize("hasPermission('/discountrule/deleterule','')")
     @ResponseBody
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/service/CusttypeReportService.java b/src/main/java/com/supwisdom/dlpay/restaurant/service/CusttypeReportService.java
index ebd82ea..c882c32 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/service/CusttypeReportService.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/service/CusttypeReportService.java
@@ -1,6 +1,7 @@
 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.DailyReportShowBean;
 import org.springframework.transaction.annotation.Transactional;
@@ -12,14 +13,13 @@
 
 
     @Transactional(rollbackFor = Exception.class,readOnly = true)
-    List<DailyReportShowBean> getDailyReportSearchData(DailyReportSearchBean searchBean);
-
+    List<CusttypeReportShowBean> getCusttypeReportSearchData(DailyReportSearchBean searchBean);
 
     @Transactional(rollbackFor = Exception.class,readOnly = true)
-    String getDailyReportSearchPeriod(DailyReportSearchBean searchBean);
+    String getCusttypeReportSearchPeriod(DailyReportSearchBean searchBean);
 
     @Transactional(rollbackFor = Exception.class,readOnly = true)
-    void doCreateDailyReportExcel(HttpServletResponse response, List<DailyReportShowBean> datalist, DailyReportSearchBean searchBean, String filename, TOperator oper);
+    void doCreateCusttypeReportExcel(HttpServletResponse response, List<CusttypeReportShowBean> datalist, DailyReportSearchBean searchBean, String filename, TOperator oper);
 
 
 }
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/service/DeviceDiscountRuleService.java b/src/main/java/com/supwisdom/dlpay/restaurant/service/DeviceDiscountRuleService.java
index 3f3f9f2..e0b8586 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/service/DeviceDiscountRuleService.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/service/DeviceDiscountRuleService.java
@@ -20,6 +20,10 @@
   @Transactional(rollbackFor = Exception.class)
   boolean deleteDiscountRule(int ruleid)throws WebCheckException;
 
+
+  @Transactional(rollbackFor = Exception.class)
+  public boolean changeDiscountRuleLimitCnt(int ruleid,int limitcnt) throws WebCheckException;
+
   @Transactional(rollbackFor = Exception.class)
   boolean closeDiscountRule(int ruleid)throws WebCheckException;
 
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/CardServiceImpl.java b/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/CardServiceImpl.java
index b7557b0..b38fbb5 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/CardServiceImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/CardServiceImpl.java
@@ -6,12 +6,10 @@
 import com.supwisdom.dlpay.restaurant.domain.TCard;
 import com.supwisdom.dlpay.restaurant.domain.TCardver;
 import com.supwisdom.dlpay.restaurant.service.CardService;
-import com.supwisdom.dlpay.restaurant.util.RestaurantConstant;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
-import java.util.Optional;
 
 @Service
 public class CardServiceImpl implements CardService {
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/CusttypeReportServiceImpl.java b/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/CusttypeReportServiceImpl.java
new file mode 100644
index 0000000..9f34a11
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/CusttypeReportServiceImpl.java
@@ -0,0 +1,275 @@
+package com.supwisdom.dlpay.restaurant.service.impl;
+
+import com.supwisdom.dlpay.framework.dao.OperatorDao;
+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.CusttypeReportShowBean;
+import com.supwisdom.dlpay.restaurant.bean.DailyReportSearchBean;
+import com.supwisdom.dlpay.restaurant.bean.DailyReportSearchData;
+import com.supwisdom.dlpay.restaurant.bean.DailyReportShowBean;
+import com.supwisdom.dlpay.restaurant.dao.CheckCtlDao;
+import com.supwisdom.dlpay.restaurant.dao.DeviceGroupDao;
+import com.supwisdom.dlpay.restaurant.dao.MealTypeDao;
+import com.supwisdom.dlpay.restaurant.dao.MealsdtlDao;
+import com.supwisdom.dlpay.restaurant.service.CusttypeReportService;
+import com.supwisdom.dlpay.restaurant.service.DailyReportService;
+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.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
+
+@Service
+public class CusttypeReportServiceImpl implements CusttypeReportService {
+
+
+    @Autowired
+    private SystemUtilService systemUtilService;
+    @Autowired
+    private CheckCtlDao checkCtlDao;
+    @Autowired
+    private OperatorDao operatorDao;
+
+
+    @PersistenceContext
+    private EntityManager entityManager;
+
+    private static final Logger logger = LoggerFactory.getLogger(CusttypeReportServiceImpl.class);
+
+
+    @Override
+    public List<CusttypeReportShowBean> getCusttypeReportSearchData(DailyReportSearchBean searchBean) {
+        if (null != searchBean) {
+            String startdate = DateUtil.unParseToDateFormat(searchBean.getStartdate());
+            String enddate = DateUtil.unParseToDateFormat(searchBean.getEnddate());
+
+            StringBuffer sb = new StringBuffer("select cast(ROW_NUMBER() OVER() as int4) as rownum,a1.groupname," +
+                    " cast(sum(case when t.mealtype='breakfast' and t.custtype=1 then t.totalcnt else 0 end) as int4) as ibtotalcnt," +
+                    " cast(sum(case when t.mealtype='lunch' and t.custtype=1 then t.totalcnt else 0 end) as int4) as iltotalcnt," +
+                    " cast(sum(case when t.mealtype='dinner' and t.custtype=1 then t.totalcnt else 0 end) as int4) as idtotalcnt," +
+                    " sum(case when t.mealtype='breakfast' and t.custtype=1 then t.feeamt+t.totalamt else 0 end) as ibtotalamt," +
+                    " sum(case when t.mealtype='lunch' and t.custtype=1 then t.feeamt+t.totalamt else 0 end) as iltotalamt," +
+                    " sum(case when t.mealtype='dinner' and t.custtype=1 then t.feeamt+t.totalamt else 0 end) as idtotalamt," +
+                    " cast(sum(case when t.mealtype='breakfast' and t.custtype=2 then t.totalcnt else 0 end) as int4) as obtotalcnt," +
+                    " cast(sum(case when t.mealtype='lunch' and t.custtype=2 then t.totalcnt else 0 end) as int4) as oltotalcnt," +
+                    " cast(sum(case when t.mealtype='dinner' and t.custtype=2 then t.totalcnt else 0 end) as int4) as odtotalcnt," +
+                    " sum(case when t.mealtype='breakfast' and t.custtype=2 then t.feeamt+t.totalamt else 0 end) as obtotalamt," +
+                    " sum(case when t.mealtype='lunch' and t.custtype=2 then t.feeamt+t.totalamt else 0 end) as oltotalamt," +
+                    " sum(case when t.mealtype='dinner' and t.custtype=2 then t.feeamt+t.totalamt else 0 end) as odtotalamt " +
+                    " from tb_rpt_mealsdtl t " +
+                    " left join tb_devicegroup a1 on t.devgroupid=a1.devgroupid" +
+                    " where t.checkdate>=:startdate and t.checkdate<=:enddate" +
+                    " group by t.devgroupid,a1.devgroupid  order by t.devgroupid");
+
+            Query query = entityManager.createNativeQuery(sb.toString());
+            query.setParameter("startdate", startdate);
+            query.setParameter("enddate", enddate);
+            query.unwrap(NativeQueryImpl.class).setResultTransformer(Transformers.aliasToBean(CusttypeReportShowBean.class));
+            List<CusttypeReportShowBean> list = query.getResultList();
+            if (null != list) return list;
+        }
+        return new ArrayList<>(0);
+
+    }
+
+    @Override
+    public String getCusttypeReportSearchPeriod(DailyReportSearchBean 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 doCreateCusttypeReportExcel(HttpServletResponse response, List<CusttypeReportShowBean> datalist, DailyReportSearchBean searchBean, String filename, TOperator oper) {
+        HSSFWorkbook workbook = new HSSFWorkbook();
+        HSSFSheet sheet = workbook.createSheet("客户类别消费报表");
+
+        int columns = 13; //
+        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, getCusttypeReportSearchPeriod(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);
+        ExcelPoiUtil.createCell(row2, 11, headStyle, null);
+        ExcelPoiUtil.createCell(row2, 12, headStyle, null);
+        ExcelPoiUtil.createCell(row2, 13, headStyle, null);
+        sheet.addMergedRegion(new CellRangeAddress(2, 2, 8, 13)); //合并单元格CellRangeAddress构造参数依次表示 起始行,截至行,起始列, 截至列
+
+
+        ExcelPoiUtil.createCell(row2, 14, headStyle, "合计\n消费金额");
+        ExcelPoiUtil.createCell(row2, 15, headStyle, "合计\n消费笔数");
+        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, 14, headStyle, null);
+        sheet.addMergedRegion(new CellRangeAddress(2, 3, 14, 14)); //合并列
+
+        ExcelPoiUtil.createCell(row3, 15, headStyle, null);
+        sheet.addMergedRegion(new CellRangeAddress(2, 3, 15, 15)); //合并列
+
+        ExcelPoiUtil.createCell(row3, 2, headStyle, "早餐\n金额");
+        ExcelPoiUtil.createCell(row3, 3, headStyle, "早餐\n份数");
+        ExcelPoiUtil.createCell(row3, 4, headStyle, "午餐\n金额");
+        ExcelPoiUtil.createCell(row3, 5, headStyle, "午餐\n份数");
+        ExcelPoiUtil.createCell(row3, 6, headStyle, "晚餐\n金额");
+        ExcelPoiUtil.createCell(row3, 7, headStyle, "晚餐\n份数");
+
+        ExcelPoiUtil.createCell(row3, 8, headStyle, "早餐\n金额");
+        ExcelPoiUtil.createCell(row3, 9, headStyle, "早餐\n份数");
+        ExcelPoiUtil.createCell(row3, 10, headStyle, "午餐\n金额");
+        ExcelPoiUtil.createCell(row3, 11, headStyle, "午餐\n份数");
+        ExcelPoiUtil.createCell(row3, 12, headStyle, "晚餐\n金额");
+        ExcelPoiUtil.createCell(row3, 13, headStyle, "晚餐\n份数");
+
+        //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++) {
+                CusttypeReportShowBean detail = datalist.get(i);
+           //     if (StringUtil.isEmpty(rowData.getDatalist())) continue;
+
+       /*         int firstRowNo = rowNum;
+                HSSFRow row = ExcelPoiUtil.createRow(sheet, rowNum++, 500);
+                ExcelPoiUtil.createCell(row, 0, textStyle1, "" + rowData.getDatalist().get(0).getCheckdate()); //日期
+*/
+        /*        for (int j = 0; j < rowData.getDatalist().size(); j++) {
+                }*/
+                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, MoneyUtil.formatYuanToString(detail.getObtotalamt())); //早餐
+                ExcelPoiUtil.createCell(row, 9, textStyle1, detail.getObtotalcnt().toString());
+                ExcelPoiUtil.createCell(row, 10, textStyle1, MoneyUtil.formatYuanToString(detail.getOltotalamt())); //午餐
+                ExcelPoiUtil.createCell(row, 11, textStyle1, detail.getOltotalcnt().toString());
+                ExcelPoiUtil.createCell(row, 12, textStyle1, MoneyUtil.formatYuanToString(detail.getOdtotalamt())); //晚餐
+                ExcelPoiUtil.createCell(row, 13, textStyle1, detail.getOdtotalcnt().toString());
+
+                ExcelPoiUtil.createCell(row, 14, textStyle1, MoneyUtil.formatYuanToString(detail.getIdtotalamt()+detail.getIbtotalamt()+detail.getIltotalamt()+detail.getOdtotalamt()+detail.getOltotalamt()+detail.getObtotalamt())); //总计
+                ExcelPoiUtil.createCell(row, 15, 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/DeviceDiscountRuleServiceImpl.java b/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/DeviceDiscountRuleServiceImpl.java
index 1a2d43f..cce8dfc 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/DeviceDiscountRuleServiceImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/DeviceDiscountRuleServiceImpl.java
@@ -123,6 +123,18 @@
     }
 
     @Override
+    public boolean changeDiscountRuleLimitCnt(int ruleid,int limitcnt) throws WebCheckException {
+        TDiscountRule rule = discountRuleDao.findByRuleid(ruleid);
+        if (null == rule) {
+            throw new WebCheckException("餐补规则不存在!");
+        }
+        rule.setLimitcnt(limitcnt);
+        rule.setStatus(RestaurantConstant.STATUS_DISCOUNTRULE_UNCHECK);
+        discountRuleDao.save(rule);
+        return true;
+    }
+
+    @Override
     public boolean closeDiscountRule(int ruleid) throws WebCheckException {
         TDiscountRule rule = discountRuleDao.findByRuleid(ruleid);
         if (null == rule) {
diff --git a/src/main/kotlin/com/supwisdom/dlpay/security.kt b/src/main/kotlin/com/supwisdom/dlpay/security.kt
index 3c52376..0fbd336 100644
--- a/src/main/kotlin/com/supwisdom/dlpay/security.kt
+++ b/src/main/kotlin/com/supwisdom/dlpay/security.kt
@@ -183,6 +183,7 @@
                         .antMatchers("/static/**").permitAll()
                         .antMatchers("/code/image").permitAll()
                         .antMatchers("/report/print/**").permitAll() //报表打印
+                        .antMatchers("/custtypereport/print/**").permitAll() //报表打印
                         .antMatchers("/dailyreport/print/**").permitAll() //报表打印
                         .antMatchers("/**").hasAnyRole("USER", "ADMIN")
                         .anyRequest().authenticated()
diff --git a/src/main/resources/data.sql b/src/main/resources/data.sql
index da059e5..c450a89 100644
--- a/src/main/resources/data.sql
+++ b/src/main/resources/data.sql
@@ -127,7 +127,8 @@
 INSERT INTO "tb_function"("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid") VALUES (35, NULL, 0, NULL, 'layui-icon-rmb', '#', '报表中心', 10, -1);
 INSERT INTO "tb_function"("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid") VALUES (36, NULL, 1, NULL, '', '/report/laborfee', '商户劳务费报表', 1, 35);
 INSERT INTO "tb_function"("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid") VALUES (37, NULL, 1, NULL, '', '/report/laborcount', '商户劳务费人次统计表', 2, 35);
-
+INSERT INTO "tb_function"("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid") VALUES (40, NULL, 1, NULL, '', '/dept/index', '部门管理', 6, 22);
+INSERT INTO "tb_function"("id", "createtime", "isleaf", "lastsaved", "menuicon", "menuurl", "name", "ordernum", "parentid") VALUES (41, NULL, 1, NULL, '', '/custtypereport/index', '人员类别消费报表', 4, 36);
 
 
 
diff --git a/src/main/resources/templates/restaurant/custtypereport/index.html b/src/main/resources/templates/restaurant/custtypereport/index.html
new file mode 100644
index 0000000..acafee3
--- /dev/null
+++ b/src/main/resources/templates/restaurant/custtypereport/index.html
@@ -0,0 +1,202 @@
+<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="custtypereport-search-form">
+            <input type="hidden" id="custtypereport-hidden-maxdate" th:value="${maxdate}" />
+            <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="custtypereport-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="custtypereport-search-enddate" placeholder="截止日期" th:value="${maxdate}"
+                               autocomplete="off" class="layui-input"/>
+                    </div>
+                </div>
+
+                <div class="layui-inline">
+                    <button id="custtypereport-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-custtypereport-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-custtypereport-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-custtypereport-table" th:fragment="custtypereportTable">
+            <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="6" 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-custtypereport-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="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+data.obtotalamt+data.oltotalamt+data.odtotalamt,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'], function () {
+        var laydate = layui.laydate;
+        var layer = layui.layer;
+        var $ = layui.jquery;
+
+        laydate.render({
+            elem: '#custtypereport-search-startdate',
+            max: $("#custtypereport-hidden-maxdate").val(),
+            trigger: 'click'
+        });
+        laydate.render({
+            elem: '#custtypereport-search-enddate',
+            max: $("#custtypereport-hidden-maxdate").val(),
+            trigger: 'click'
+        });
+
+        $('#custtypereport-search-btn').click(function () {
+            var startdate = $("#custtypereport-search-startdate").val();
+            var enddate = $("#custtypereport-search-enddate").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: '[[@{/custtypereport/custtypereportlist}]]',
+                type: "POST",
+                data: {
+                    startdate: startdate,
+                    enddate: enddate,
+                    _csrf: $("meta[name='_csrf_token']").attr("value")
+                },
+                success: function (data) {
+                    $("#shopreport-custtypereport-table").html(data);
+                    layer.closeAll('loading');
+                },
+                error: function (status, err) {
+                    layer.closeAll('loading');
+                    layer.msg('查询失败了', {icon: 2});
+                }
+            });
+        });
+
+        $("#shopreport-custtypereport-export-excel").click(function(){
+            var startdate= $("#shopreport-custtypereport-tbody").attr("data-startdate");
+            var enddate= $("#shopreport-custtypereport-tbody").attr("data-enddate");
+
+            var dataUrl='[[@{/custtypereport/excelexport}]]?startdate='+startdate+'&enddate='+enddate;
+            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-custtypereport-print-table").click(function(){
+            var startdate= $("#shopreport-custtypereport-tbody").attr("data-startdate");
+            var enddate= $("#shopreport-custtypereport-tbody").attr("data-enddate");
+            var opercode = $("#shopreport-custtypereport-tbody").attr("data-opercode");
+            var url = '/custtypereport/print/printcusttypereport?startdate=' + startdate + '&enddate=' + enddate +  '&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/custtypereport/print/printcusttypereport.html b/src/main/resources/templates/restaurant/custtypereport/print/printcusttypereport.html
new file mode 100644
index 0000000..b380bd3
--- /dev/null
+++ b/src/main/resources/templates/restaurant/custtypereport/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+data.obtotalamt+data.oltotalamt+data.odtotalamt,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/dailyreport/index.html b/src/main/resources/templates/restaurant/dailyreport/index.html
index 4c087dc..0ab457f 100644
--- a/src/main/resources/templates/restaurant/dailyreport/index.html
+++ b/src/main/resources/templates/restaurant/dailyreport/index.html
@@ -212,7 +212,7 @@
             }
         });
 
-    
+
         $('#dailyreport-search-btn').click(function () {
             var startdate = $("#dailyreport-search-startdate").val();
             var enddate = $("#dailyreport-search-enddate").val();
diff --git a/src/main/resources/templates/restaurant/discountrule/rule.html b/src/main/resources/templates/restaurant/discountrule/rule.html
index 9ca17e2..de36541 100644
--- a/src/main/resources/templates/restaurant/discountrule/rule.html
+++ b/src/main/resources/templates/restaurant/discountrule/rule.html
@@ -85,7 +85,7 @@
                             return parseFloat(d.amount).toFixed(2);
                         }
                     },
-                    {field: 'limitcnt', title: '可使用次数/人',  align: 'center'},
+                    {field: 'limitcnt', title: '可使用次数/人',  align: 'center',edit: 'text'},
                     {
                         field: 'status', title: '状态', align: 'center', width: 120, sort: true, templet: function (d) {
                             if ('uncheck' == d.status) {
@@ -125,6 +125,32 @@
             });
         });
 
+
+        table.on('edit(discountruleTable-filter)', function (obj) {
+            var row = obj.data; //得到所在行所有键值
+            var limitcnt = obj.value; //得到修改后的值
+            admin.go('[[@{/discountrule/changelimit}]]', {
+                ruleid: row.ruleid,
+                limitcnt: limitcnt,
+                _csrf: $("meta[name='_csrf_token']").attr("value"),
+            }, function (data) {
+                if (data.code == 200) {
+                    layer.msg("修改成功", {icon: 1});
+                } else if (data.code == 401) {
+                    layer.msg(data.msg, {icon: 2, time: 1500}, function () {
+                        location.replace('[[@{/login}]]');
+                    }, 1000);
+                    return;
+                } else {
+                    layer.msg(data.msg, {icon: 2});
+                    table.reload('discountruleTable');
+                }
+            },function () {
+                layer.msg('修改失败了,请稍后再试', {icon: 2});
+                table.reload('discountruleTable');
+            });
+        })
+
         //监听单元格
         table.on('tool(discountruleTable-filter)', function (obj) {
             var data = obj.data;
diff --git a/src/main/resources/templates/restaurant/discountrule/rulecheck.html b/src/main/resources/templates/restaurant/discountrule/rulecheck.html
index 96891f9..cc42109 100644
--- a/src/main/resources/templates/restaurant/discountrule/rulecheck.html
+++ b/src/main/resources/templates/restaurant/discountrule/rulecheck.html
@@ -127,6 +127,8 @@
             table.reload('discountrulecheckTable', {where: {status: state}, page: {curr: 1}});
         });
 
+
+
         //监听单元格
         table.on('tool(discountrulecheckTable-filter)', function (obj) {
             var data = obj.data;
diff --git a/src/main/resources/templates/restaurant/report/print/printlaborfee.html b/src/main/resources/templates/restaurant/report/print/printlaborfee.html
index 69ceb7b..f1c5eb4 100644
--- a/src/main/resources/templates/restaurant/report/print/printlaborfee.html
+++ b/src/main/resources/templates/restaurant/report/print/printlaborfee.html
@@ -18,11 +18,11 @@
             <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: 35px;">序号</th>
-                <th rowspan="3" style="text-align: center;min-width: 100px;">单位</th>
-                <th rowspan="3" style="text-align: center;min-width: 100px;">食堂</th>
+            <thead>"
+            <tr>"
+                <th rowspan="3" style="text-align: center">序号</th>
+                <th rowspan="3" style="text-align: center">单位</th>
+                <th rowspan="3" style="text-align: center">食堂</th>
                 <th colspan="3" style="text-align: center;">消费正价</th>
                 <th colspan="3" style="text-align: center;">优惠后支付</th>
                 <th colspan="4" style="text-align: center;">应支付劳务费</th>
@@ -117,12 +117,16 @@
     <div class="layui-card-body" style="margin-top: 25px;">
         <table class="sw-print-sign">
             <tr>
-                <td width="50%">银行方审核盖章:</td>
+                <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>
@@ -130,17 +134,14 @@
             <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>
+<!--            <tr>-->
+<!--                <td>市民卡公司审核盖章:</td>-->
+<!--                <td>建桥园审核盖章:</td>-->
+<!--            </tr>-->
+<!--            <tr>-->
+<!--                <td>审核人:</td>-->
+<!--                <td>审核人:</td>-->
+<!--            </tr>-->
         </table>
     </div>
 </div>