部门功能,部门分餐表(未完)
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/bean/DeptReportSearchBean.java b/src/main/java/com/supwisdom/dlpay/restaurant/bean/DeptReportSearchBean.java
new file mode 100644
index 0000000..cf2f7d2
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/bean/DeptReportSearchBean.java
@@ -0,0 +1,33 @@
+package com.supwisdom.dlpay.restaurant.bean;
+
+import com.supwisdom.dlpay.system.bean.PageBean;
+
+public class DeptReportSearchBean extends PageBean {
+    private String startdate;
+    private String enddate;
+    private String deptcode;
+
+    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 String getDeptcode() {
+        return deptcode;
+    }
+
+    public void setDeptcode(String deptcode) {
+        this.deptcode = deptcode;
+    }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/bean/DeptReportSearchData.java b/src/main/java/com/supwisdom/dlpay/restaurant/bean/DeptReportSearchData.java
new file mode 100644
index 0000000..aebeae7
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/bean/DeptReportSearchData.java
@@ -0,0 +1,181 @@
+package com.supwisdom.dlpay.restaurant.bean;
+
+import java.math.BigInteger;
+
+public class DeptReportSearchData {
+  private String deptname;
+  private String deptcode;
+  private String childdeptname;
+  private String childdeptcode;
+
+
+  private Double btotalamt; //早餐总金额
+  private BigInteger btotalcnt;//早餐份数
+  private Double ltotalamt; //午餐总金额
+  private BigInteger ltotalcnt;//午餐份数
+  private Double dtotalamt; //晚餐总金额
+  private BigInteger dtotalcnt;//晚餐份数
+
+  private Double bpayamt; //早餐支付金额
+  private BigInteger bpaycnt;
+  private Double lpayamt; //午餐支付总金额
+  private BigInteger lpaycnt;
+  private Double dpayamt; //晚餐支付总金额
+  private BigInteger dpaycnt;
+
+  private Double bfeeamt; //早餐支付金额
+  private Double lfeeamt; //午餐支付总金额
+  private Double dfeeamt; //晚餐支付总金额
+
+  public String getDeptname() {
+    return deptname;
+  }
+
+  public void setDeptname(String deptname) {
+    this.deptname = deptname;
+  }
+
+  public String getDeptcode() {
+    return deptcode;
+  }
+
+  public void setDeptcode(String deptcode) {
+    this.deptcode = deptcode;
+  }
+
+  public String getChilddeptname() {
+    return childdeptname;
+  }
+
+  public void setChilddeptname(String childdeptname) {
+    this.childdeptname = childdeptname;
+  }
+
+  public String getChilddeptcode() {
+    return childdeptcode;
+  }
+
+  public void setChilddeptcode(String childdeptcode) {
+    this.childdeptcode = childdeptcode;
+  }
+
+  public BigInteger getBtotalcnt() {
+    return btotalcnt;
+  }
+
+  public void setBtotalcnt(BigInteger btotalcnt) {
+    this.btotalcnt = btotalcnt;
+  }
+
+  public BigInteger getLtotalcnt() {
+    return ltotalcnt;
+  }
+
+  public void setLtotalcnt(BigInteger ltotalcnt) {
+    this.ltotalcnt = ltotalcnt;
+  }
+
+  public BigInteger getDtotalcnt() {
+    return dtotalcnt;
+  }
+
+  public void setDtotalcnt(BigInteger dtotalcnt) {
+    this.dtotalcnt = dtotalcnt;
+  }
+
+  public BigInteger getBpaycnt() {
+    return bpaycnt;
+  }
+
+  public void setBpaycnt(BigInteger bpaycnt) {
+    this.bpaycnt = bpaycnt;
+  }
+
+  public BigInteger getLpaycnt() {
+    return lpaycnt;
+  }
+
+  public void setLpaycnt(BigInteger lpaycnt) {
+    this.lpaycnt = lpaycnt;
+  }
+
+  public BigInteger getDpaycnt() {
+    return dpaycnt;
+  }
+
+  public void setDpaycnt(BigInteger dpaycnt) {
+    this.dpaycnt = dpaycnt;
+  }
+
+  public Double getBtotalamt() {
+    return btotalamt;
+  }
+
+  public void setBtotalamt(Double btotalamt) {
+    this.btotalamt = btotalamt;
+  }
+
+  public Double getLtotalamt() {
+    return ltotalamt;
+  }
+
+  public void setLtotalamt(Double ltotalamt) {
+    this.ltotalamt = ltotalamt;
+  }
+
+  public Double getDtotalamt() {
+    return dtotalamt;
+  }
+
+  public void setDtotalamt(Double dtotalamt) {
+    this.dtotalamt = dtotalamt;
+  }
+
+  public Double getBpayamt() {
+    return bpayamt;
+  }
+
+  public void setBpayamt(Double bpayamt) {
+    this.bpayamt = bpayamt;
+  }
+
+  public Double getLpayamt() {
+    return lpayamt;
+  }
+
+  public void setLpayamt(Double lpayamt) {
+    this.lpayamt = lpayamt;
+  }
+
+  public Double getDpayamt() {
+    return dpayamt;
+  }
+
+  public void setDpayamt(Double dpayamt) {
+    this.dpayamt = dpayamt;
+  }
+
+  public Double getBfeeamt() {
+    return bfeeamt;
+  }
+
+  public void setBfeeamt(Double bfeeamt) {
+    this.bfeeamt = bfeeamt;
+  }
+
+  public Double getLfeeamt() {
+    return lfeeamt;
+  }
+
+  public void setLfeeamt(Double lfeeamt) {
+    this.lfeeamt = lfeeamt;
+  }
+
+  public Double getDfeeamt() {
+    return dfeeamt;
+  }
+
+  public void setDfeeamt(Double dfeeamt) {
+    this.dfeeamt = dfeeamt;
+  }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/bean/DeptReportShowBean.java b/src/main/java/com/supwisdom/dlpay/restaurant/bean/DeptReportShowBean.java
new file mode 100644
index 0000000..9b0f7ff
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/bean/DeptReportShowBean.java
@@ -0,0 +1,218 @@
+package com.supwisdom.dlpay.restaurant.bean;
+
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
+
+public class DeptReportShowBean {
+  private String deptname;
+  private String deptcode;
+  private String childdeptname;
+  private String childdeptcode;
+
+  private Double btotalamt; //早餐总金额
+  private BigInteger btotalcnt;//早餐份数
+  private Double ltotalamt; //午餐总金额
+  private BigInteger ltotalcnt;//午餐份数
+  private Double dtotalamt; //晚餐总金额
+  private BigInteger dtotalcnt;//晚餐份数
+
+  private Double bpayamt; //早餐支付金额
+  private BigInteger bpaycnt;
+  private Double lpayamt; //午餐支付总金额
+  private BigInteger lpaycnt;
+  private Double dpayamt; //晚餐支付总金额
+  private BigInteger dpaycnt;
+
+  private Double bfeeamt; //早餐支付金额
+  private Double lfeeamt; //午餐支付总金额
+  private Double dfeeamt; //晚餐支付总金额
+
+  private List<DeptReportSearchData> datalist = new ArrayList<DeptReportSearchData>(0);
+
+  public DeptReportShowBean(){
+
+  }
+
+  public DeptReportShowBean(String deptname, String deptcode, String childdeptname, String childdeptcode, Double btotalamt, BigInteger btotalcnt, Double ltotalamt, BigInteger ltotalcnt, Double dtotalamt, BigInteger dtotalcnt, Double bpayamt, BigInteger bpaycnt, Double lpayamt, BigInteger lpaycnt, Double dpayamt, BigInteger dpaycnt, Double bfeeamt, Double lfeeamt, Double dfeeamt) {
+    this.deptname = deptname;
+    this.deptcode = deptcode;
+    this.childdeptname = childdeptname;
+    this.childdeptcode = childdeptcode;
+    this.btotalamt = btotalamt;
+    this.btotalcnt = btotalcnt;
+    this.ltotalamt = ltotalamt;
+    this.ltotalcnt = ltotalcnt;
+    this.dtotalamt = dtotalamt;
+    this.dtotalcnt = dtotalcnt;
+    this.bpayamt = bpayamt;
+    this.bpaycnt = bpaycnt;
+    this.lpayamt = lpayamt;
+    this.lpaycnt = lpaycnt;
+    this.dpayamt = dpayamt;
+    this.dpaycnt = dpaycnt;
+    this.bfeeamt = bfeeamt;
+    this.lfeeamt = lfeeamt;
+    this.dfeeamt = dfeeamt;
+  }
+
+  public List<DeptReportSearchData> getDatalist() {
+    return datalist;
+  }
+
+  public void setDatalist(List<DeptReportSearchData> datalist) {
+    this.datalist = datalist;
+  }
+
+  public String getDeptcode() {
+    return deptcode;
+  }
+
+  public void setDeptcode(String deptcode) {
+    this.deptcode = deptcode;
+  }
+
+  public String getDeptname() {
+    return deptname;
+  }
+
+  public void setDeptname(String deptname) {
+    this.deptname = deptname;
+  }
+
+  public String getChilddeptname() {
+    return childdeptname;
+  }
+
+  public void setChilddeptname(String childdeptname) {
+    this.childdeptname = childdeptname;
+  }
+
+  public String getChilddeptcode() {
+    return childdeptcode;
+  }
+
+  public void setChilddeptcode(String childdeptcode) {
+    this.childdeptcode = childdeptcode;
+  }
+
+  public BigInteger getBtotalcnt() {
+    return btotalcnt;
+  }
+
+  public void setBtotalcnt(BigInteger btotalcnt) {
+    this.btotalcnt = btotalcnt;
+  }
+
+  public BigInteger getLtotalcnt() {
+    return ltotalcnt;
+  }
+
+  public void setLtotalcnt(BigInteger ltotalcnt) {
+    this.ltotalcnt = ltotalcnt;
+  }
+
+  public BigInteger getDtotalcnt() {
+    return dtotalcnt;
+  }
+
+  public void setDtotalcnt(BigInteger dtotalcnt) {
+    this.dtotalcnt = dtotalcnt;
+  }
+
+  public BigInteger getBpaycnt() {
+    return bpaycnt;
+  }
+
+  public void setBpaycnt(BigInteger bpaycnt) {
+    this.bpaycnt = bpaycnt;
+  }
+
+  public BigInteger getLpaycnt() {
+    return lpaycnt;
+  }
+
+  public void setLpaycnt(BigInteger lpaycnt) {
+    this.lpaycnt = lpaycnt;
+  }
+
+  public BigInteger getDpaycnt() {
+    return dpaycnt;
+  }
+
+  public void setDpaycnt(BigInteger dpaycnt) {
+    this.dpaycnt = dpaycnt;
+  }
+
+  public Double getBtotalamt() {
+    return btotalamt;
+  }
+
+  public void setBtotalamt(Double btotalamt) {
+    this.btotalamt = btotalamt;
+  }
+
+  public Double getLtotalamt() {
+    return ltotalamt;
+  }
+
+  public void setLtotalamt(Double ltotalamt) {
+    this.ltotalamt = ltotalamt;
+  }
+
+  public Double getDtotalamt() {
+    return dtotalamt;
+  }
+
+  public void setDtotalamt(Double dtotalamt) {
+    this.dtotalamt = dtotalamt;
+  }
+
+  public Double getBpayamt() {
+    return bpayamt;
+  }
+
+  public void setBpayamt(Double bpayamt) {
+    this.bpayamt = bpayamt;
+  }
+
+  public Double getLpayamt() {
+    return lpayamt;
+  }
+
+  public void setLpayamt(Double lpayamt) {
+    this.lpayamt = lpayamt;
+  }
+
+  public Double getDpayamt() {
+    return dpayamt;
+  }
+
+  public void setDpayamt(Double dpayamt) {
+    this.dpayamt = dpayamt;
+  }
+
+  public Double getBfeeamt() {
+    return bfeeamt;
+  }
+
+  public void setBfeeamt(Double bfeeamt) {
+    this.bfeeamt = bfeeamt;
+  }
+
+  public Double getLfeeamt() {
+    return lfeeamt;
+  }
+
+  public void setLfeeamt(Double lfeeamt) {
+    this.lfeeamt = lfeeamt;
+  }
+
+  public Double getDfeeamt() {
+    return dfeeamt;
+  }
+
+  public void setDfeeamt(Double dfeeamt) {
+    this.dfeeamt = dfeeamt;
+  }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/bean/DeptSearchBean.java b/src/main/java/com/supwisdom/dlpay/restaurant/bean/DeptSearchBean.java
new file mode 100644
index 0000000..da93407
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/bean/DeptSearchBean.java
@@ -0,0 +1,24 @@
+package com.supwisdom.dlpay.restaurant.bean;
+
+import com.supwisdom.dlpay.system.bean.PageBean;
+
+public class DeptSearchBean extends PageBean {
+    private String deptname;
+    private String deptcode;
+
+    public String getDeptname() {
+        return deptname;
+    }
+
+    public void setDeptname(String deptname) {
+        this.deptname = deptname;
+    }
+
+    public String getDeptcode() {
+        return deptcode;
+    }
+
+    public void setDeptcode(String deptcode) {
+        this.deptcode = deptcode;
+    }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/bean/TDeptShowBean.java b/src/main/java/com/supwisdom/dlpay/restaurant/bean/TDeptShowBean.java
new file mode 100644
index 0000000..e6c695d
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/bean/TDeptShowBean.java
@@ -0,0 +1,62 @@
+package com.supwisdom.dlpay.restaurant.bean;
+
+
+import java.math.BigInteger;
+
+public class TDeptShowBean {
+    private  BigInteger deptno;
+    private String deptcode;
+    private String deptname;
+    private String fdeptcode;
+    private String ename;
+    private String lastsaved;
+
+
+    public BigInteger getDeptno() {
+        return deptno;
+    }
+
+    public void setDeptno(BigInteger deptno) {
+        this.deptno = deptno;
+    }
+
+    public String getDeptcode() {
+        return deptcode;
+    }
+
+    public void setDeptcode(String deptcode) {
+        this.deptcode = deptcode;
+    }
+
+    public String getDeptname() {
+        return deptname;
+    }
+
+    public void setDeptname(String deptname) {
+        this.deptname = deptname;
+    }
+
+    public String getFdeptcode() {
+        return fdeptcode;
+    }
+
+    public void setFdeptcode(String fdeptcode) {
+        this.fdeptcode = fdeptcode;
+    }
+
+    public String getEname() {
+        return ename;
+    }
+
+    public void setEname(String ename) {
+        this.ename = ename;
+    }
+
+    public String getLastsaved() {
+        return lastsaved;
+    }
+
+    public void setLastsaved(String lastsaved) {
+        this.lastsaved = lastsaved;
+    }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/controller/DeptController.java b/src/main/java/com/supwisdom/dlpay/restaurant/controller/DeptController.java
new file mode 100644
index 0000000..50280a9
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/controller/DeptController.java
@@ -0,0 +1,140 @@
+package com.supwisdom.dlpay.restaurant.controller;
+
+
+import com.google.gson.Gson;
+import com.supwisdom.dlpay.api.bean.JsonResult;
+import com.supwisdom.dlpay.framework.util.ExportExcel;
+import com.supwisdom.dlpay.framework.util.PageResult;
+import com.supwisdom.dlpay.framework.util.WebConstant;
+import com.supwisdom.dlpay.restaurant.bean.DeptSearchBean;
+import com.supwisdom.dlpay.restaurant.bean.TDeptShowBean;
+import com.supwisdom.dlpay.restaurant.domain.TDept;
+import com.supwisdom.dlpay.restaurant.service.DeptService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Controller
+@RequestMapping("/dept")
+public class DeptController {
+
+    @Autowired
+    private DeptService deptService;
+
+    @RequestMapping("/index")
+    public String indexView(ModelMap model) {
+        List<TDept> lst = deptService.findAll();
+        Map<String, String> map = new HashMap<>();
+        for (TDept dept : lst) {
+            map.put(dept.getDeptcode(), dept.getDeptname());
+        }
+        Gson gson = new Gson();
+        String gsonString = gson.toJson(map);
+        model.put("deptList", gsonString);
+        return "restaurant/dept/index";
+    }
+
+    @RequestMapping("/list")
+    @PreAuthorize("hasPermission('/dept/index','')")
+    @ResponseBody
+    public PageResult<TDeptShowBean> getDataList(@RequestParam("page") Integer pageNo,
+                                                 @RequestParam("limit") Integer pageSize,
+                                                 @RequestParam(value = "deptname", required = false) String deptname,
+                                                 @RequestParam(value = "deptcode", required = false) String deptcode) {
+        try {
+            if (null == pageNo || pageNo < 1) pageNo = WebConstant.PAGENO_DEFAULT;
+            if (null == pageSize || pageSize < 1) pageSize = WebConstant.PAGESIZE_DEFAULT;
+            DeptSearchBean searchBean = new DeptSearchBean();
+            searchBean.setPageNo(pageNo);
+            searchBean.setDeptname(deptname);
+            searchBean.setDeptcode(deptcode);
+            searchBean.setPageSize(pageSize);
+            return deptService.getDeptByKey(searchBean);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return new PageResult<>(99, "系统查询错误");
+        }
+    }
+
+
+    @GetMapping("/loadadd")
+    @PreAuthorize("hasPermission('/dept/loadadd','')")
+    public String loadadd(Model model) {
+        List<TDept> list = deptService.findFDept();
+        model.addAttribute("fdeptlist", list);
+        return "restaurant/dept/form";
+    }
+
+    @PostMapping("/add")
+    @PreAuthorize("hasPermission('/dept/add','')")
+    @ResponseBody
+    public JsonResult add(@RequestBody TDept dept) {
+        System.out.println(dept);
+        if (dept != null) {
+            return deptService.saveDept(dept);
+        } else {
+            return JsonResult.error("添加失败");
+        }
+    }
+
+    @GetMapping("/checkdeptno")
+    @ResponseBody
+    public JsonResult delete(@RequestParam String deptno) {
+        if(deptService.checkDeptnoExists(deptno)){
+            return JsonResult.ok();
+        }
+
+        return JsonResult.error("部门代码已存在");
+    }
+
+
+    @PostMapping("/delete")
+    @PreAuthorize("hasPermission('/dept/delete','')")
+    @ResponseBody
+    public JsonResult delete(@RequestParam Long deptno) {
+        return deptService.delete(deptno);
+    }
+
+    @GetMapping("/loadimport")
+    public String loadimport(Model model) {
+        return "restaurant/dept/import";
+    }
+
+
+    @RequestMapping("/download")
+    @ResponseBody
+    public JsonResult downloadfile(HttpServletRequest request, HttpServletResponse response) throws Exception{
+        String[] titles0 = {"部门编号",	"部门名称",	"上级部门编号(若为根部门则填0)","部门英文名称(选填)"
+        }; //表头
+        String[][] info0 = {{"01",	"测试部门",	"0",""
+        }}; // 示例内容
+        String fileName0 = "部门导入模板";// 保存数据
+
+        try {
+            ExportExcel.queryexcel(fileName0, titles0,info0,request, response);
+            return JsonResult.ok("操作成功");
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return JsonResult.error("操作失败");
+    }
+
+    @PostMapping("/import")
+    @PreAuthorize("hasPermission('/dept/import','')")
+    @ResponseBody
+    public JsonResult importFile(@RequestParam(value = "file",required = false) MultipartFile file, HttpServletRequest request) throws Exception{
+//    System.out.println("---------under the upload file:"+file);
+        return deptService.importFile(file,request);
+    }
+
+}
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/controller/DeptReportController.java b/src/main/java/com/supwisdom/dlpay/restaurant/controller/DeptReportController.java
new file mode 100644
index 0000000..27fc99a
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/controller/DeptReportController.java
@@ -0,0 +1,110 @@
+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.DailyReportShowBean;
+import com.supwisdom.dlpay.restaurant.service.DailyReportService;
+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;
+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("/deptreport")
+public class DeptReportController {
+
+    @Autowired
+    private SystemUtilService systemUtilService;
+    @Autowired
+    private DailyReportService dailyReportService;
+    @Autowired
+    private StatementReportService statementReportService;
+
+    //TODO
+    @RequestMapping("/index")
+    public String indexView(
+            @ModelAttribute("searchBean") DailyReportSearchBean 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);
+        searchBean.setGroupid(0);
+        model.addAttribute("showlist", dailyReportService.getDailyReportSearchData(searchBean));
+
+        model.addAttribute("maxdate", maxdate);
+
+        TOperator oper = (TOperator) operUser;
+        model.addAttribute("opercode", oper == null ? "unknow" : oper.getOpercode());
+        return "restaurant/deptreport/index";
+    }
+
+    @RequestMapping("/deptreportlist")
+    @PreAuthorize("hasPermission('/deptreport/deptreportlist','')")
+    public String getDataList(
+            @ModelAttribute("searchBean") DailyReportSearchBean searchBean,
+            @AuthenticationPrincipal UserDetails operUser,
+            ModelMap map) {
+        try {
+
+            TOperator oper = (TOperator) operUser;
+            map.addAttribute("opercode", oper == null ? "unknow" : oper.getOpercode());
+
+            List<DailyReportShowBean> bean = dailyReportService.getDailyReportSearchData(searchBean);
+
+            map.addAttribute("showlist",bean);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return "restaurant/deptreport/index::deptreportTable";
+    }
+
+    @GetMapping("/excelexportdeptreport")
+    public void excelExportDeptfee(@ModelAttribute("searchBean") DailyReportSearchBean searchBean,
+                                    @AuthenticationPrincipal UserDetails operUser,
+                                    HttpServletRequest request, HttpServletResponse response, ModelMap map){
+        try {
+            List<DailyReportShowBean> datalist = dailyReportService.getDailyReportSearchData(searchBean);
+            TOperator oper = (TOperator) operUser;
+            String filename="食堂日结报表";
+            dailyReportService.doCreateDailyReportExcel(response, datalist, searchBean, filename, oper);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+
+    @GetMapping("/print/printdeptreport")
+    public String printLaborfee(@ModelAttribute("searchBean") DailyReportSearchBean searchBean,
+                                @RequestParam(value = "opercode",required = false) String opercode, ModelMap map) {
+        try {
+            map.addAttribute("showlist", dailyReportService.getDailyReportSearchData(searchBean));
+
+            TOperator oper = statementReportService.getOperatorByOpercode(opercode);
+            map.addAttribute("opername", oper == null ? "unknow" : oper.getOpername());
+            map.addAttribute("period", dailyReportService.getDailyReportSearchPeriod(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";
+    }
+
+
+}
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/dao/DeptDao.java b/src/main/java/com/supwisdom/dlpay/restaurant/dao/DeptDao.java
index fdcb31d..2506a7b 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/dao/DeptDao.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/dao/DeptDao.java
@@ -8,8 +8,22 @@
 import java.util.List;
 
 @Repository
-public interface DeptDao extends JpaRepository<TDept, String> {
+public interface DeptDao extends JpaRepository<TDept, Long> {
 
   @Query("from TDept t where t.status='normal' ")
   List<TDept> findNormalDept();
+
+  List<TDept> findByFdeptcode(String fdeptcode);
+
+  List<TDept> findByDeptcode(String deptcode);
+
+  Integer countByDeptcode(String deptcode);
+
+  Integer countByFdeptcode(String fdeptcode);
+
+
+  @Query(value = "select distinct deptno from tb_dept where deptno=?1 or fdept=?1",nativeQuery = true)
+  List<String> findDeptnoByDeptno(String deptno);
+  @Query(value = "select distinct deptno from tb_dept",nativeQuery = true)
+  List<String> findAllDeptno();
 }
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 6762816..64d5678 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/dao/DeviceGroupDao.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/dao/DeviceGroupDao.java
@@ -16,7 +16,6 @@
 
     int deleteByDevgroupid(Integer Devgroupid);
 
-
     Integer countByPid(Integer Devgroupid);
 
     List<TDeviceGroup> findByGrouptype(String grouptype);
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/domain/TCustomer.java b/src/main/java/com/supwisdom/dlpay/restaurant/domain/TCustomer.java
index 276225b..38b47ad 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/domain/TCustomer.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/domain/TCustomer.java
@@ -22,7 +22,7 @@
     private String status;
     private String checkstatus;
 
-    private String deptcode;
+    private String deptno;
 
     @Id
     @GenericGenerator(name = "idGenerator", strategy = "uuid")
@@ -132,12 +132,12 @@
         this.checkstatus = checkstatus;
     }
 
-    @Column(name = "DEPTCODE", length = 32)
-    public String getDeptcode() {
-        return deptcode;
+    @Column(name = "DEPTNO", length = 32)
+    public String getDeptno() {
+        return deptno;
     }
 
-    public void setDeptcode(String deptcode) {
-        this.deptcode = deptcode;
+    public void setDeptno(String deptno) {
+        this.deptno = deptno;
     }
 }
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/domain/TDept.java b/src/main/java/com/supwisdom/dlpay/restaurant/domain/TDept.java
index b901fdc..64727b9 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/domain/TDept.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/domain/TDept.java
@@ -9,11 +9,11 @@
   @Id
   @SequenceGenerator(name = "pk_dept_deptcode", sequenceName = "SEQ_DEPTCODE", allocationSize = 1, initialValue = 10)
   @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "pk_dept_deptcode")
-  @Column(name="DEPTCODE", nullable = false, length = 32)
-  private String deptcode; //ID
+  @Column(name="deptno", nullable = false, length = 32)
+  private Long deptno; //ID
 
-  @Column(name="DEPTNO", nullable = false, length = 20)
-  private String deptno;  //部门编号,可能会要修改,不能为主键,唯一索引
+  @Column(name="deptcode", nullable = false, length = 20)
+  private String deptcode;  //部门编号,可能会要修改,不能为主键,唯一索引
 
   @Column(name="DEPTNAME", precision = 600)
   private String deptname; //部门名称
@@ -30,6 +30,14 @@
   @Column(name="LASTSAVED", length = 20)
   private String lastsaved; //最后更新时间
 
+  public Long getDeptno() {
+    return deptno;
+  }
+
+  public void setDeptno(Long deptno) {
+    this.deptno = deptno;
+  }
+
   public String getDeptcode() {
     return deptcode;
   }
@@ -38,14 +46,6 @@
     this.deptcode = deptcode;
   }
 
-  public String getDeptno() {
-    return deptno;
-  }
-
-  public void setDeptno(String deptno) {
-    this.deptno = deptno;
-  }
-
   public String getDeptname() {
     return deptname;
   }
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/service/DailyReportService.java b/src/main/java/com/supwisdom/dlpay/restaurant/service/DailyReportService.java
index 855d621..cde8d49 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/service/DailyReportService.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/service/DailyReportService.java
@@ -13,9 +13,6 @@
 
 public interface DailyReportService {
 
-    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class,readOnly = true)
-    PageResult<MealsDtlShowBean> getMealsdtlByKey(DailyReportSearchBean param);
-
 
     @Transactional(rollbackFor = Exception.class,readOnly = true)
     List<DailyReportShowBean> getDailyReportSearchData(DailyReportSearchBean searchBean);
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/service/DeptReportService.java b/src/main/java/com/supwisdom/dlpay/restaurant/service/DeptReportService.java
new file mode 100644
index 0000000..db873bc
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/service/DeptReportService.java
@@ -0,0 +1,22 @@
+package com.supwisdom.dlpay.restaurant.service;
+
+import com.supwisdom.dlpay.framework.domain.TOperator;
+import com.supwisdom.dlpay.restaurant.bean.*;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+public interface DeptReportService {
+
+    @Transactional(rollbackFor = Exception.class,readOnly = true)
+    List<DeptReportShowBean> getDeptReportSearchData(DeptReportSearchBean searchBean);
+
+    @Transactional(rollbackFor = Exception.class,readOnly = true)
+    String getDeptReportSearchPeriod(DeptReportSearchBean searchBean);
+
+    @Transactional(rollbackFor = Exception.class,readOnly = true)
+    void doCreateDeptReportExcel(HttpServletResponse response, List<DeptReportShowBean> datalist, DeptReportSearchBean searchBean, String filename, TOperator oper);
+
+
+}
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/service/DeptService.java b/src/main/java/com/supwisdom/dlpay/restaurant/service/DeptService.java
new file mode 100644
index 0000000..2ee5589
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/service/DeptService.java
@@ -0,0 +1,48 @@
+package com.supwisdom.dlpay.restaurant.service;
+
+import com.supwisdom.dlpay.api.bean.JsonResult;
+import com.supwisdom.dlpay.framework.util.PageResult;
+import com.supwisdom.dlpay.restaurant.bean.AreaSearchBean;
+import com.supwisdom.dlpay.restaurant.bean.DeptSearchBean;
+import com.supwisdom.dlpay.restaurant.bean.TDeptShowBean;
+import com.supwisdom.dlpay.restaurant.domain.TArea;
+import com.supwisdom.dlpay.restaurant.domain.TDeviceGroup;
+import com.supwisdom.dlpay.system.bean.ZTreeNode;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.supwisdom.dlpay.restaurant.domain.TDept;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.List;
+
+public interface DeptService {
+    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
+    PageResult<ZTreeNode> getDeptTree();
+
+    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
+    PageResult<TDeptShowBean> getDeptByKey(DeptSearchBean param);
+
+    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
+    List<TDept> findAll();
+
+    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
+    boolean checkDeptnoExists(String deptno);
+
+    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, readOnly = true)
+    List<TDept> findFDept();
+
+    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
+    JsonResult saveDept(TDept dept);
+
+    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
+    JsonResult delete(Long deptcode);
+
+
+    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
+    JsonResult importFile(MultipartFile file, HttpServletRequest request) throws Exception;
+
+
+
+}
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 6f2eea3..32258a5 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
@@ -429,7 +429,7 @@
 
   private String getDefaultDeptcode() {
     List<TDept> list = deptDao.findNormalDept();
-    if (!StringUtil.isEmpty(list)) return list.get(0).getDeptcode();
+    if (!StringUtil.isEmpty(list)) return list.get(0).getDeptcode().toString();
     return "unknow";
   }
 
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/DailyReportServiceImpl.java b/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/DailyReportServiceImpl.java
index d1c7ed0..d29a26d 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/DailyReportServiceImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/DailyReportServiceImpl.java
@@ -58,7 +58,7 @@
 
     private static final Logger logger = LoggerFactory.getLogger(DailyReportServiceImpl.class);
 
-    @Override
+  /*  @Override
     public PageResult<MealsDtlShowBean> getMealsdtlByKey(DailyReportSearchBean param) {
         List<Integer> groupids;
         if (null != param.getGroupid()) {
@@ -84,11 +84,11 @@
 
             for (MealsDtlList dtl : dtls) {
                 String groupname = dtl.getGroupname();
-               /* if(StringUtil.isEmpty(groupname)){
+               *//* if(StringUtil.isEmpty(groupname)){
                     groupname=deviceGroupDao.findById(groupid).get().getGroupname();
-                }*/
+                }*//*
                 bean.setDevgroupname(groupname);
-             /*   if(null==dtl.getAmount()){
+             *//*   if(null==dtl.getAmount()){
                     bean.setB_amt(0d);
                     bean.setB_cnt(0);
                     bean.setB_feeamt(0d);
@@ -110,7 +110,7 @@
                     bean.setT_feecnt(0);
                     bean.setT_getamt(0d);
                     break;
-                }*/
+                }*//*
 
                 totamt += dtl.getAmount();
                 totcnt += dtl.getCnt();
@@ -152,7 +152,7 @@
 
         return new PageResult<>(showBeans);
 
-    }
+    }*/
 
 
     @Override
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/DeptReportServiceImpl.java b/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/DeptReportServiceImpl.java
new file mode 100644
index 0000000..bf9e8a3
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/DeptReportServiceImpl.java
@@ -0,0 +1,190 @@
+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.PageResult;
+import com.supwisdom.dlpay.framework.util.StringUtil;
+import com.supwisdom.dlpay.restaurant.bean.*;
+import com.supwisdom.dlpay.restaurant.dao.*;
+import com.supwisdom.dlpay.restaurant.service.DailyReportService;
+import com.supwisdom.dlpay.restaurant.service.DeptReportService;
+import com.supwisdom.dlpay.restaurant.service.DeptService;
+import com.supwisdom.dlpay.restaurant.util.ExcelPoiUtil;
+import com.supwisdom.dlpay.restaurant.util.RestaurantConstant;
+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 DeptReportServiceImpl implements DeptReportService {
+
+    @Autowired
+    private MealsdtlDao mealsdtlDao;
+    @Autowired
+    private DeptDao deptDao;
+    @Autowired
+    private MealTypeDao mealTypeDao;
+    @Autowired
+    private SystemUtilService systemUtilService;
+    @Autowired
+    private CheckCtlDao checkCtlDao;
+    @Autowired
+    private OperatorDao operatorDao;
+
+
+    @PersistenceContext
+    private EntityManager entityManager;
+
+    private static final Logger logger = LoggerFactory.getLogger(DeptReportServiceImpl.class);
+
+
+    @Override
+    public List<DeptReportShowBean> getDeptReportSearchData(DeptReportSearchBean searchBean) {
+        if (null != searchBean) {
+            String startdate = DateUtil.unParseToDateFormat(searchBean.getStartdate());
+            String enddate = DateUtil.unParseToDateFormat(searchBean.getEnddate());
+
+            StringBuffer sb = new StringBuffer("select case when a2.deptcode is not null then a2.deptcode when a1.deptcode is not null then a1.deptcode else t.deptcode end as deptcode," +
+                    " case when a2.deptcode is not null then a2.deptname when a1.deptcode is not null then a1.deptname else '' end as deptname, " +
+                    " t.deptcode as childdeptcode, case when a1.deptcode is not null then a1.deptname else '' end as childdeptname, " +
+                    " sum(case when t.mealtype='breakfast' then t.totalamt+t.feeamt else 0 end) as btotalamt, " +
+                    " sum(case when t.mealtype='breakfast' then t.totalcnt else 0 end) as btotalcnt, " +
+                    " sum(case when t.mealtype='lunch' then t.totalamt+t.feeamt else 0 end) as ltotalamt, " +
+                    " sum(case when t.mealtype='lunch' then t.totalcnt else 0 end) as ltotalcnt, " +
+                    " sum(case when t.mealtype='dinner' then t.totalamt+t.feeamt else 0 end) as dtotalamt, " +
+                    " sum(case when t.mealtype='dinner' then t.totalcnt else 0 end) as dtotalcnt, " +
+                    " sum(case when t.mealtype='breakfast' then t.totalamt else 0 end) as bpayamt, " +
+                    " sum(case when t.mealtype='breakfast' then t.feecnt else 0 end) as bpaycnt, " +
+                    " sum(case when t.mealtype='lunch' then t.totalamt else 0 end) as lpayamt, " +
+                    " sum(case when t.mealtype='lunch' then t.feecnt else 0 end) as lpaycnt, " +
+                    " sum(case when t.mealtype='dinner' then t.totalamt else 0 end) as dpayamt, " +
+                    " sum(case when t.mealtype='dinner' then t.feecnt else 0 end) as dpaycnt, " +
+                    " sum(case when t.mealtype='breakfast' then t.feeamt else 0 end) as bfeeamt, " +
+                    " sum(case when t.mealtype='lunch' then t.feeamt else 0 end) as lfeeamt, " +
+                    " sum(case when t.mealtype='dinner' then t.feeamt else 0 end) as dfeeamt " +
+                    "from tb_rpt_mealsdtl t " +
+                    "left join tb_dept a1 on t.deptcode=a1.deptcode " + 
+                    "left join tb_dept a2 on a1.fdeptcode=a2.deptcode " +
+                    "where t.checkdate>=:startdate and t.checkdate<=:enddate and t.deptcode=:deptcode " +
+                    "group by t.deptcode,a1.deptname,a2.deptname,a1.deptcode,a2.deptcode  order by t.deptcode ");
+
+            Query query = entityManager.createNativeQuery(sb.toString());
+            query.setParameter("startdate", startdate);
+            query.setParameter("enddate", enddate);
+            query.setParameter("groupid", searchBean.getDeptcode());
+            query.unwrap(NativeQueryImpl.class).setResultTransformer(Transformers.aliasToBean(DeptReportSearchData.class));
+            List<DeptReportSearchData> list = query.getResultList();
+            if (null != list) return transforDeptReportShowBean(list);
+        }
+        return new ArrayList<>(0);
+
+    }
+
+    @Override
+    public String getDeptReportSearchPeriod(DeptReportSearchBean searchBean) {
+        return null;
+    }
+
+    @Override
+    public void doCreateDeptReportExcel(HttpServletResponse response, List<DeptReportShowBean> datalist, DeptReportSearchBean searchBean, String filename, TOperator oper) {
+
+    }
+
+    private List<DeptReportShowBean> transforDeptReportShowBean(List<DeptReportSearchData> list) {
+        if (StringUtil.isEmpty(list)) return new ArrayList<>(0);
+
+        List<DeptReportShowBean> result = new ArrayList<>(0);
+        BigInteger bitg=BigInteger.valueOf(0l);
+        DeptReportShowBean sumBean = new DeptReportShowBean("总 计","","","", 0d,bitg,0d,bitg,0d,bitg,0d,bitg,0d,bitg,0d,bitg,0d,0d,0d);
+        for (DeptReportSearchData data : list) {
+            sumBean.setBtotalamt(sumBean.getBtotalamt() + data.getBtotalamt());
+            sumBean.setBtotalcnt(sumBean.getBtotalcnt().add(data.getBtotalcnt())  );
+            sumBean.setLtotalamt(sumBean.getLtotalamt() + data.getLtotalamt());
+            sumBean.setLtotalcnt(sumBean.getLtotalcnt().add(data.getLtotalcnt()));
+            sumBean.setDtotalamt(sumBean.getDtotalamt() + data.getDtotalamt());
+            sumBean.setDtotalcnt(sumBean.getDtotalcnt().add(data.getDtotalcnt())  );
+            sumBean.setBpayamt(sumBean.getBpayamt() + data.getBpayamt());
+            sumBean.setBpaycnt(sumBean.getBpaycnt().add(data.getBpaycnt())  );
+            sumBean.setLpayamt(sumBean.getLpayamt() + data.getLpayamt());
+            sumBean.setLpaycnt(sumBean.getLpaycnt().add(data.getLpaycnt())  );
+            sumBean.setDpayamt(sumBean.getDpayamt() + data.getDpayamt());
+            sumBean.setDpaycnt(sumBean.getDpaycnt().add(data.getDpaycnt())  );
+            sumBean.setBfeeamt(sumBean.getBfeeamt() + data.getBfeeamt());
+            sumBean.setLfeeamt(sumBean.getLfeeamt() + data.getLfeeamt());
+            sumBean.setDfeeamt(sumBean.getDfeeamt() + data.getDfeeamt()); //总计求和
+
+
+            boolean exist = false;
+            for (DeptReportShowBean bean : result) {
+                if (bean.getDeptcode() == data.getDeptcode()) {
+                    exist = true;
+                    bean.getDatalist().add(data);
+                    bean.setBtotalamt(bean.getBtotalamt() + data.getBtotalamt());
+                    bean.setBtotalcnt(bean.getBtotalcnt().add(data.getBtotalcnt())  );
+                    bean.setLtotalamt(bean.getLtotalamt() + data.getLtotalamt());
+                    bean.setLtotalcnt(bean.getLtotalcnt().add(data.getLtotalcnt()));
+                    bean.setDtotalamt(bean.getDtotalamt() + data.getDtotalamt());
+                    bean.setDtotalcnt(bean.getDtotalcnt().add(data.getDtotalcnt())  );
+                    bean.setBpayamt(bean.getBpayamt() + data.getBpayamt());
+                    bean.setBpaycnt(bean.getBpaycnt().add(data.getBpaycnt())  );
+                    bean.setLpayamt(bean.getLpayamt() + data.getLpayamt());
+                    bean.setLpaycnt(bean.getLpaycnt().add(data.getLpaycnt())  );
+                    bean.setDpayamt(bean.getDpayamt() + data.getDpayamt());
+                    bean.setDpaycnt(bean.getDpaycnt().add(data.getDpaycnt())  );
+                    bean.setBfeeamt(bean.getBfeeamt() + data.getBfeeamt());
+                    bean.setLfeeamt(bean.getLfeeamt() + data.getLfeeamt());
+                    bean.setDfeeamt(bean.getDfeeamt() + data.getDfeeamt());
+                    break;
+                }
+            }
+
+            if (!exist) {
+                DeptReportShowBean tmp = new DeptReportShowBean();
+
+                //      String chkdate = DateUtil.reformatDatetime(data.getDeptname(), "yyyyMMdd", "yyyy-MM-dd");
+                tmp.setDeptcode(data.getDeptcode());
+                tmp.setDeptname(data.getDeptname());
+                tmp.setBtotalamt(data.getBtotalamt());
+                tmp.setBtotalcnt(data.getBtotalcnt());
+                tmp.setLtotalamt(data.getLtotalamt());
+                tmp.setLtotalcnt(data.getLtotalcnt());
+                tmp.setDtotalamt(data.getDtotalamt());
+                tmp.setDtotalcnt(data.getDtotalcnt());
+                tmp.setBpayamt(data.getBpayamt());
+                tmp.setBpaycnt(data.getBpaycnt());
+                tmp.setLpayamt(data.getLpayamt());
+                tmp.setLpaycnt(data.getLpaycnt());
+                tmp.setDpayamt(data.getDpayamt());
+                tmp.setDpaycnt(data.getDpaycnt());
+                tmp.setBfeeamt(data.getBfeeamt());
+                tmp.setLfeeamt(data.getLfeeamt());
+                tmp.setDfeeamt(data.getDfeeamt());
+                result.add(tmp);
+            }
+
+        }
+
+        result.add(sumBean); //最后加上总计
+        return result;
+    }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/DeptServiceImpl.java b/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/DeptServiceImpl.java
new file mode 100644
index 0000000..96ffa1d
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/DeptServiceImpl.java
@@ -0,0 +1,203 @@
+package com.supwisdom.dlpay.restaurant.service.impl;
+
+import com.supwisdom.dlpay.api.bean.JsonResult;
+import com.supwisdom.dlpay.framework.util.DateUtil;
+import com.supwisdom.dlpay.framework.util.ImportExcelUtil;
+import com.supwisdom.dlpay.framework.util.PageResult;
+import com.supwisdom.dlpay.framework.util.StringUtil;
+import com.supwisdom.dlpay.restaurant.bean.DeptSearchBean;
+import com.supwisdom.dlpay.restaurant.bean.TDeptShowBean;
+import com.supwisdom.dlpay.restaurant.dao.DeptDao;
+import com.supwisdom.dlpay.restaurant.domain.TDept;
+import com.supwisdom.dlpay.restaurant.service.DeptService;
+import com.supwisdom.dlpay.system.bean.ZTreeNode;
+import org.hibernate.query.internal.NativeQueryImpl;
+import org.hibernate.transform.Transformers;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.data.domain.Pageable;
+import org.springframework.data.domain.Sort;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.Query;
+import javax.servlet.http.HttpServletRequest;
+import java.io.InputStream;
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+@Service
+public class DeptServiceImpl implements DeptService {
+    @Autowired
+    private DeptDao deptDao;
+
+
+    @PersistenceContext
+    private EntityManager entityManager;
+
+
+    @Override
+    public PageResult<ZTreeNode> getDeptTree() {
+        List<TDept> groups=deptDao.findAll();
+        List<ZTreeNode> zlist=new ArrayList<>();
+        for(TDept g:groups){
+            ZTreeNode z=new ZTreeNode();
+            z.setId(g.getDeptcode().toString());
+            z.setName(g.getDeptname());
+            if(g.getFdeptcode()==null){
+                z.setpId("0");
+            }else{
+                z.setpId(g.getDeptcode().toString());
+            }
+            z.setChecked(false);
+            z.setOpen(true);
+            zlist.add(z);
+        }
+        PageResult<ZTreeNode> p=new PageResult<>(zlist);
+        p.setCode(0);
+        return p;
+    }
+
+    @Override
+    public PageResult<TDeptShowBean> getDeptByKey(DeptSearchBean param) {
+
+        StringBuffer querySql = new StringBuffer("select t.deptcode,t.deptno,t.deptname, " +
+                "t.fdeptcode,t.ename,t.lastsaved from tb_dept t where 1=1 ");
+        StringBuffer countSql = new StringBuffer("select count(*) as cnt from tb_dept t " +
+                " where 1=1 ");
+        if (!StringUtil.isEmpty(param.getDeptname())) {
+            querySql.append(" and  t.deptname like :str ");
+            countSql.append(" and  t.deptname like :str ");
+        }
+        if (!StringUtil.isEmpty(param.getDeptcode())) {
+            querySql.append(" and  t.deptcode = :deptcode ");
+            countSql.append(" and  t.deptcode = :deptcode ");
+        }
+        querySql.append(" order by t.deptcode ");
+        Query query = entityManager.createNativeQuery(querySql.toString());
+        Query countQuery = entityManager.createNativeQuery(countSql.toString());
+        if (!StringUtil.isEmpty(param.getDeptname())) {
+            query.setParameter("str", "%" + param.getDeptname().trim() + "%");
+            countQuery.setParameter("str", "%" + param.getDeptname().trim() + "%");
+        }
+        if (!StringUtil.isEmpty(param.getDeptcode())) {
+            query.setParameter("deptcode", "%" + param.getDeptcode().trim() + "%");
+            countQuery.setParameter("deptcode", "%" + param.getDeptcode().trim() + "%");
+        }
+        query.setFirstResult((param.getPageNo() - 1) * param.getPageSize());
+        query.setMaxResults(param.getPageSize()); //分页显示
+        query.unwrap(NativeQueryImpl.class).setResultTransformer(Transformers.aliasToBean(TDeptShowBean.class));
+        List<TDeptShowBean> list = query.getResultList();
+        BigInteger count = (BigInteger) countQuery.getSingleResult();
+        return new PageResult<>(count.longValue(), list);
+    }
+
+    @Override
+    public List<TDept> findAll() {
+        return deptDao.findAll();
+    }
+
+    @Override
+    public boolean checkDeptnoExists(String deptcode) {
+        List<TDept> depts=deptDao.findByDeptcode(deptcode);
+        if(depts.size()>0){
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public List<TDept> findFDept() {
+        return deptDao.findByFdeptcode("0");
+    }
+
+    @Override
+    public JsonResult saveDept(TDept dept) {
+        dept.setLastsaved(DateUtil.getNow());
+        dept.setStatus("normal");
+        deptDao.save(dept);
+
+        return JsonResult.ok("保存成功");
+    }
+
+    @Override
+    public JsonResult delete(Long deptcode) {
+        deptDao.deleteById(deptcode);
+        return JsonResult.ok("成功");
+    }
+
+    @Override
+    public JsonResult importFile(MultipartFile file, HttpServletRequest request) throws Exception {
+        String fname = file.getOriginalFilename();
+        if (!fname.endsWith(".xls") && !fname.endsWith(".xlsx")) {
+
+            return JsonResult.error("文件格式错误,请选择excel文件格式(.xls/.xlsx)");
+        }
+
+//    InputStream excelstream = new FileInputStream(savePath+"/"+fname);
+        InputStream excelstream = file.getInputStream();
+        List<Object[][]> oList = null;
+        try {
+            if (fname.endsWith(".xls")) {
+                oList = ImportExcelUtil.getIntegralData(excelstream);//2003版本
+            } else {
+                oList = ImportExcelUtil.getIntegralData07(excelstream);//2007版本以上
+            }
+        } catch (Exception e) {
+            return JsonResult.error("模板格式错误,请重新下载模板");
+        }
+
+
+        String msg = "";
+        Integer successCnt = 0;
+        Integer failCnt = 0;
+        String batchno = DateUtil.getNow("yyyyMMddHHmmss");
+        for (Object[][] data : oList) {
+            for (int i = 1; i < data.length; i++) {
+                String deptcode=(String) data[i][0];
+                String deptname=(String) data[i][1];
+                String fdeptcode=(String) data[i][2];
+
+                if (StringUtil.isEmpty((String) data[i][0]) || StringUtil.isEmpty((String) data[i][1]) || StringUtil.isEmpty((String) data[i][2])) {
+                    msg = msg + "第" + i + "行,关键字段缺失。<br/>";
+                    failCnt += 1;
+                } else if (deptDao.countByDeptcode(deptcode) > 0) {
+                    msg = msg + "第" + i + "行,该部门编号在系统中已存在。<br/>";
+                    failCnt += 1;
+                } else if (deptDao.countByFdeptcode(fdeptcode) > 0) {
+                    msg = msg + "第" + i + "行,上级部门系统中不存在。<br/>";
+                    failCnt += 1;
+                } else {
+                    TDept d = new TDept();
+                    d.setDeptname(deptname);
+                    d.setDeptcode(deptcode);
+                    d.setFdeptcode(fdeptcode);
+                    d.setLastsaved(batchno);
+                    if (null != data[i][3]) {
+                        d.setEname((String) data[i][3]);
+                    }
+
+                    d.setStatus("normal");
+                    saveDept(d);
+                    successCnt += 1;
+                }
+            }
+        }
+        /*resp.setCode(Code.SUCCESS);
+        // resp.setMsg("成功导入了"+sList.size()+"条信息");
+        resp.setMsg(String.format(Locale.CHINESE, msg));
+        return resp;*/
+
+
+        if (StringUtil.isEmpty(msg)) {
+            return JsonResult.ok("成功导入" + oList.size() + "条信息");
+        }
+        msg = "导入成功" + successCnt + "条,导入失败" + failCnt + "条<br/>" + msg;
+
+        return JsonResult.error(String.format(Locale.CHINESE, msg));
+    }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/StatementReportServiceImpl.java b/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/StatementReportServiceImpl.java
index 3472a38..394849d 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/StatementReportServiceImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/StatementReportServiceImpl.java
@@ -87,7 +87,8 @@
           " sum(case when t.mealtype='breakfast' then t.feeamt else 0 end) as bfeeamt, " +
           " sum(case when t.mealtype='lunch' then t.feeamt else 0 end) as lfeeamt, " +
           " sum(case when t.mealtype='dinner' then t.feeamt else 0 end) as dfeeamt " +
-          "from tb_rpt_mealsdtl t left join tb_devicegroup a1 on t.devgroupid=a1.devgroupid left join tb_devicegroup a2 on a1.pid=a2.devgroupid " +
+          "from tb_rpt_mealsdtl t left join tb_devicegroup a1 on t.devgroupid=a1.devgroupid " +
+              "left join tb_devicegroup a2 on a1.pid=a2.devgroupid " +
           "where t.checkdate>=:startdate and t.checkdate<=:enddate " +
           "group by t.devgroupid,a1.devgroupid,a2.devgroupid order by t.devgroupid ");
       Query query = entityManager.createNativeQuery(sb.toString());
diff --git a/src/main/resources/templates/restaurant/dept/form.html b/src/main/resources/templates/restaurant/dept/form.html
new file mode 100644
index 0000000..e828411
--- /dev/null
+++ b/src/main/resources/templates/restaurant/dept/form.html
@@ -0,0 +1,138 @@
+
+<form id="dept-form" lay-filter="form" class="layui-form model-form">
+    <input name="deptno" id="dept-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 name="deptcode" placeholder="不能重复" type="text" class="layui-input" maxlength="20"
+                   lay-verify="required|deptcode" 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 name="deptname" type="text" class="layui-input"
+                   required/>
+        </div>
+    </div>
+    <div class="layui-form-item">
+        <label class="layui-form-label"></span>部门英语名称</label>
+        <div class="layui-input-block">
+            <input name="ename"  type="text" class="layui-input" maxlength="20"
+                  />
+        </div>
+    </div>
+
+    <div class="layui-form-item">
+        <label class="layui-form-label">上级部门</label>
+        <div class="layui-input-block">
+            <select name="fdeptcode" id="dept-fdeptcode" lay-verify="required">
+                <option  value="0">根部门</option>
+                <option th:each="type : ${fdeptlist}" th:value="${type.deptcode}">[[${type.deptname}]]</option>
+            </select>
+        </div>
+    </div>
+
+   <!-- <div class="layui-form-item">
+        <label class="layui-form-label">上级部门</label>
+        <div class="layui-input-block">
+            <input type="text" name="fdeptcode" id="dept-fdeptcode"  lay-filter="dept-search-fdeptcode-filter"
+                   autocomplete="off" class="layui-input"/>
+        </div>
+    </div>-->
+
+
+    <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="dept-form-submit" lay-submit id="submitbtn">保存</button>
+    </div>
+</form>
+
+<script>
+    layui.use(['layer', 'admin', 'form', 'formSelects'], function () {
+        var layer = layui.layer;
+        var admin = layui.admin;
+        var form = layui.form;
+        form.render('select');
+        form.render('radio');
+        form.verify({
+
+            "deptcode": function (e) {
+                if(""==e|| ""==$.trim(e)){
+                    return "部门代码不能为空";
+                }
+
+                var msg = "";
+                $.ajax({
+                    type: "GET",
+                    url: '[[@{/dept/checkdeptcode}]]',
+                    async: false, //同步提交。不设置则默认异步,异步的话,最后执行ajax
+                    data: {
+                        deptcode: e,
+                    },
+                    success: function (result) {
+                        if (result.code != 200) {
+                            msg = result.msg;
+                        }
+                    },
+                    error: function (error) {
+                        msg = "请求服务器校验账号失败";
+                    }
+                });
+                if (msg != "") {
+                    return msg;
+                }
+            }
+        });
+
+        var url = '[[@{/dept/add}]]';
+        // 回显user数据
+        var dev = admin.getTempData('t_dev');
+        if (dev) {
+            $('input[name="deptcode"]').attr('readonly', 'readonly');
+            form.val('form', dev);
+        }
+       /* let fid = admin.getTempData("fid");
+        if (fid) {
+            form.val('form', {"fid": fid});
+        }*/
+        // 表单提交事件
+        form.on('submit(dept-form-submit)', function (data) {
+            console.log(data);
+            layer.load(2);
+            let token = $("meta[name='_csrf_token']").attr("value");
+            console.log(token);
+            $.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 {
+                        console.log('err:' + result.code);
+                        layer.msg(result.msg, {icon: 2});
+                    }
+                },
+                error: function () {
+                    layer.closeAll('loading');
+                    layer.msg("请求服务器失败!", {icon: 2});
+                }
+            });
+            return false;
+        });
+    });
+</script>
\ No newline at end of file
diff --git a/src/main/resources/templates/restaurant/dept/import.html b/src/main/resources/templates/restaurant/dept/import.html
new file mode 100644
index 0000000..6249a7a
--- /dev/null
+++ b/src/main/resources/templates/restaurant/dept/import.html
@@ -0,0 +1,97 @@
+<div style="color: #0c91e5" align="right">
+    <a th:href="@{/device/download}" class="layui-btn layui-btn-primary" style="margin: 5px">点击此处下载导入模板</a>
+</div>
+<form lay-filter="form" class="layui-form model-form" >
+    <!-- row -->
+    <div class="layui-form-item">
+        <label class="control-label">请选择导入文件<span class="required"> * </span></label>
+        <input type="file" name="file" id="device-file" placeholder="请选择xls格式文件">
+    </div>
+  <!--  <div class="layui-input-inline" style="width: auto;margin-left:3%">
+        <button type="button" class="layui-btn upoadfile-btn" >
+            <i class="layui-icon">&#xe67c;</i>点击上传
+            <input type="file" name="file" id="file" style="width:auto;"/>
+        </button>
+    </div>-->
+
+    <!-- /row -->
+    <!-- row -->
+    <div class="layui-form-item" align="center">
+        <div id="device-importError" style="color:red">
+        </div>
+        <div id="importInfo" >
+        </div>
+    </div>
+
+    <!--    <div class="form-actions right">
+            <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
+            <button type="submit" class="btn btn-success" >保存</button>
+        </div>-->
+    <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="device-form-import" lay-submit id="importbtn">保存</button>
+    </div>
+</form>
+
+<script>
+    layui.use(['layer', 'admin', 'form', 'formSelects'], function () {
+        var layer = layui.layer;
+        var admin = layui.admin;
+        var form = layui.form;
+
+        var url = '[[@{/device/import}]]';
+        // 回显user数据
+
+        /* let fid = admin.getTempData("fid");
+         if (fid) {
+             form.val('form', {"fid": fid});
+         }*/
+        // 表单提交事件
+        form.on('submit(device-form-import)', function (data) {
+            $("#device-importError").html("");
+            var files = $('#device-file').prop('files');
+            var formData = new FormData();
+            $.each(files, function (i, file) {
+
+                formData.append('file', file);
+            });
+            console.log(formData);
+            layer.load(2);
+            let token = $("meta[name='_csrf_token']").attr("value");
+            $.ajax({
+                type: "POST",
+                url: url,
+                dataType: 'json',
+                processData:false,
+                contentType: false,
+                data: formData,
+                headers: {
+                    'Accept': 'application/json',
+                    'X-CSRF-TOKEN': token,
+                },
+                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 {
+                        $("#device-importError").html("导入结束,导入失败信息:<br/>" + result.msg);
+
+                        console.log('err:' + result.code);
+                      /*  layer.msg(result.msg, {icon: 2});*/
+                    }
+                },
+                error: function () {
+                    layer.closeAll('loading');
+                    layer.msg("请求服务器失败!", {icon: 2});
+                }
+            });
+            return false;
+        });
+    });
+</script>
\ No newline at end of file
diff --git a/src/main/resources/templates/restaurant/dept/index.html b/src/main/resources/templates/restaurant/dept/index.html
new file mode 100644
index 0000000..718795c
--- /dev/null
+++ b/src/main/resources/templates/restaurant/dept/index.html
@@ -0,0 +1,148 @@
+<div class="layui-card">
+    <div class="layui-card-header">
+        <h2 class="header-title">部门管理</h2>
+        <span class="layui-breadcrumb pull-right">
+          <a href="#">部门管理</a>
+          <a><cite>部门管理</cite></a>
+        </span>
+    </div>
+    <div class="layui-card-body">
+        <div class="layui-form toolbar">
+            搜索:
+            <input id="dept-deptname" class="layui-input search-input" type="text" placeholder="部门名称"/>&emsp;
+            <input id="dept-deptcode" class="layui-input search-input" type="text" placeholder="部门代码"/>&emsp;
+
+            <button id="dept-btn-search" class="layui-btn icon-btn" data-type="search"><i class="layui-icon">&#xe615;</i>搜索
+            </button>
+            <button id="dept-btn-add" class="layui-btn icon-btn" data-type="add"><i class="layui-icon"></i>添加部门</button>
+            <button id="dept-btn-import" class="layui-btn icon-btn" ><i class="layui-icon"></i>批量导入</button>
+
+        </div>
+        <table class="layui-table" id="dept-table" lay-filter="dept-table"></table>
+    </div>
+</div>
+<input hidden th:value="${deptList}" id="deptlist">
+<script>
+
+    var rawlist=$("#deptlist").val();
+    var deptlist=JSON.parse(rawlist);
+
+    layui.use(['form', 'table', 'layer', 'admin', 'element'], function () {
+        let form = layui.form;
+        let table = layui.table;
+        let admin = layui.admin;
+
+        form.render('select');
+
+        // 渲染表格
+        table.render({
+            elem: '#dept-table',
+            url: '[[@{/dept/list}]]',
+            page: true,
+            cols: [
+                [
+                    {field: 'deptcode', title: '部门代码', sort: true},
+                    {field: 'deptname', sort: true, width: 200, title: '部门名称'},
+                    {field: 'fdeptcode',
+                        sort: true, width: 200,
+                        title: '上级部门名称',
+                        templet: function (item) {
+                            if (item.fdeptcode == '0') {
+                                return '根部门';
+                            }  else {
+                                return deptlist[item.deptcode];
+                            }
+
+                            // return areaList.get(item.id);
+                        }},
+                    {field: 'ename', sort: true, width: 200, title: '部门英语名称'},
+                    {field: 'lastsaved', sort: true, width: 170, title: '保存时间'},
+
+
+                    {
+                        field: 'id', align: 'center', title: '操作', fixed: 'right', templet: function (item) {
+                            return ' <a class="layui-btn  layui-btn-xs" lay-event="dept-edit"><i class="layui-icon layui-icon-edit"></i>编辑</a> '+
+                                ' <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="dept-del"><i class="layui-icon layui-icon-delete"></i>删除</a>';;
+                        }
+                    }
+                ]
+            ]
+        });
+        // 搜索按钮点击事件
+        $('#dept-btn-search').click(function () {
+            let key = $('#dept-search-value').val().trim();
+            table.reload('dept-table', {where: {searchkey: key}, page: {curr: 1}});
+        });
+        $('#dept-btn-add').click(function () {
+            showDeptModel();
+        });
+        $('#dept-btn-import').click(function () {
+            showDownload();
+        });
+        let showDownload = function () {
+            let title ='导入';
+            admin.popupCenter({
+                title: title,
+                path: '[[@{/dept/loadimport}]]',
+                finish: function () {
+                    table.reload('dept-table', {});
+                }
+            });
+        };
+        let showDeptModel = function (data) {
+            let title = data ? '修改部门' : '添加部门';
+            admin.putTempData('t_dev', data);
+            admin.popupCenter({
+                title: title,
+                path: '[[@{/dept/loadadd}]]',
+                finish: function () {
+                    table.reload('dept-table', {});
+                }
+            });
+        };
+
+
+        // 工具条点击事件
+        table.on('tool(dept-table)', function (obj) {
+            let data = obj.data;
+            let layEvent = obj.event;
+            console.log(data);
+            if (layEvent === 'dept-edit') {
+                showDeptModel(data);
+            }else if (layEvent === 'dept-del') {
+                showDeptDelete(data);
+            }
+        });
+        let showDeptDelete = function (data) {
+            layer.confirm('确定要删除吗?', function (i) {
+                layer.close(i);
+                layer.load(2);
+                let token = $("meta[name='_csrf_token']").attr("value");
+                admin.go('[[@{/dept/delete}]]', {
+                    deptno: data.deptno,
+                    _csrf: token
+                }, function (data) {
+                    console.log(data.code);
+                    layer.closeAll('loading');
+                    if (data.code == 200) {
+                        layer.msg(data.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('dept-table', {});
+                }, function (ret) {
+                    console.log(ret);
+                    layer.closeAll('loading');
+                    layer.msg('请求失败了,请稍后再试', {icon: 2});
+                });
+            });
+        };
+
+
+    });
+</script>
diff --git a/src/main/resources/templates/restaurant/deptreport/index.html b/src/main/resources/templates/restaurant/deptreport/index.html
new file mode 100644
index 0000000..d13199d
--- /dev/null
+++ b/src/main/resources/templates/restaurant/deptreport/index.html
@@ -0,0 +1,358 @@
+<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="deptreport-search-form">
+            <input type="hidden" id="deptreport-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="deptreport-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="deptreport-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="deptreport-search-devgroup"  lay-filter="deptreport-search-devgroup-filter"
+                               autocomplete="off" class="layui-input"/>
+                    </div>
+                </div>
+
+                <div class="layui-inline">
+                    <button id="deptreport-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-deptreport-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-deptreport-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-deptreport-table" th:fragment="deptreportTable">
+            <thead>
+            <tr>
+                <th rowspan="3" style="text-align: center;min-width: 100px;">部门</th>
+                <th rowspan="3" style="text-align: center;min-width: 100px;">子部门</th>
+                <th colspan="8" style="text-align: center;">消费正价</th>
+                <th colspan="8" style="text-align: center;">优惠后支付</th>
+                <th colspan="4" 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>
+                <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-deptreport-tbody" th:data-startdate="${searchBean.startdate}" th:data-enddate="${searchBean.enddate}" th:data-groupid="${searchBean.deptcode}" th:data-opercode="${opercode}">
+            <tr th:if="${null==showlist || showlist.size()==0}">
+                <td colspan="23">无数据</td>
+            </tr>
+
+            <div th:remove="tag" th:if="${null!=showlist && showlist.size()>0}" th:each="data:${showlist}" >
+                <tr th:if=${!dataStat.last}>
+                    <td th:text="${data.datalist[0].deptname}"  th:rowspan="${data.datalist.size()}"></td>
+                    <td th:text="${childCount>0}?${#numbers.formatDecimal(data.datalist[0].btotalamt,1,2)}:''"></td>
+                    <td th:text="${childCount>0}?${data.datalist[0].btotalcnt}:''"></td>
+                    <td th:text="${childCount>0}?${#numbers.formatDecimal(data.datalist[0].ltotalamt,1,2)}:''"></td>
+                    <td th:text="${childCount>0}?${data.datalist[0].ltotalcnt}:''"></td>
+                    <td th:text="${childCount>0}?${#numbers.formatDecimal(data.datalist[0].dtotalamt,1,2)}:''"></td>
+                    <td th:text="${childCount>0}?${data.datalist[0].dtotalcnt}:''"></td>
+                    <td th:text="${childCount>0}?${#numbers.formatDecimal(data.datalist[0].ttotalamt,1,2)}:''"></td>
+                    <td th:text="${childCount>0}?${data.datalist[0].ttotalcnt}:''"></td>
+                    <td th:text="${childCount>0}?${#numbers.formatDecimal(data.datalist[0].bpayamt,1,2)}:''"></td>
+                    <td th:text="${childCount>0}?${data.datalist[0].bpaycnt}:''"></td>
+                    <td th:text="${childCount>0}?${#numbers.formatDecimal(data.datalist[0].lpayamt,1,2)}:''"></td>
+                    <td th:text="${childCount>0}?${data.datalist[0].lpaycnt}:''"></td>
+                    <td th:text="${childCount>0}?${#numbers.formatDecimal(data.datalist[0].dpayamt,1,2)}:''"></td>
+                    <td th:text="${childCount>0}?${data.datalist[0].dpaycnt}:''"></td>
+                    <td th:text="${childCount>0}?${#numbers.formatDecimal(data.datalist[0].tpayamt,1,2)}:''"></td>
+                    <td th:text="${childCount>0}?${data.datalist[0].tpaycnt}:''"></td>
+                    <td th:text="${childCount>0}?${#numbers.formatDecimal(data.datalist[0].bfeeamt,1,2)}:''"></td>
+                    <td th:text="${childCount>0}?${#numbers.formatDecimal(data.datalist[0].lfeeamt,1,2)}:''"></td>
+                    <td th:text="${childCount>0}?${#numbers.formatDecimal(data.datalist[0].dfeeamt,1,2)}:''"></td>
+                    <td th:text="${childCount>0}?${#numbers.formatDecimal(data.datalist[0].bfeeamt+data.datalist[0].lfeeamt+data.datalist[0].dfeeamt,1,2)}:''"></td>
+                </tr>
+                <tr th:each="article,stats:${data.datalist}" th:if="${!stats.first}">
+                    <td th:text="${article.deptname}"></td>
+                    <td th:text="${#numbers.formatDecimal(article.btotalamt,1,2)}"></td>
+                    <td th:text="${article.btotalcnt}"></td>
+                    <td th:text="${#numbers.formatDecimal(article.ltotalamt,1,2)}"></td>
+                    <td th:text="${article.ltotalcnt}"></td>
+                    <td th:text="${#numbers.formatDecimal(article.dtotalamt,1,2)}"></td>
+                    <td th:text="${article.dtotalcnt}"></td>
+                    <td th:text="${#numbers.formatDecimal(article.btotalamt+article.ltotalamt+article.dtotalamt,1,2)}"></td>
+                    <td th:text="${article.btotalcnt+article.ltotalcnt+article.dtotalcnt}"></td>
+                    <td th:text="${#numbers.formatDecimal(article.bpayamt,1,2)}"></td>
+                    <td th:text="${article.bpaycnt}"></td>
+                    <td th:text="${#numbers.formatDecimal(article.lpayamt,1,2)}"></td>
+                    <td th:text="${article.lpaycnt}"></td>
+                    <td th:text="${#numbers.formatDecimal(article.dpayamt,1,2)}"></td>
+                    <td th:text="${article.dpaycnt}"></td>
+                    <td th:text="${#numbers.formatDecimal(article.bpayamt+article.lpayamt+article.dpayamt,1,2)}"></td>
+                    <td th:text="${article.bpaycnt+article.lpaycnt+article.dpaycnt}"></td>
+                    <td th:text="${#numbers.formatDecimal(article.bfeeamt,1,2)}"></td>
+                    <td th:text="${#numbers.formatDecimal(article.lfeeamt,1,2)}"></td>
+                    <td th:text="${#numbers.formatDecimal(article.dfeeamt,1,2)}"></td>
+                    <td th:text="${#numbers.formatDecimal(article.bfeeamt+article.lfeeamt+article.dfeeamt,1,2)}"></td>
+                </tr>
+                <tr th:if="${childCount>1}">
+                    <td th:text="${data.deptname}"></td>
+                    <td th:text="${#numbers.formatDecimal(data.btotalamt,1,2)}"></td>
+                    <td th:text="${data.btotalcnt}"></td>
+                    <td th:text="${#numbers.formatDecimal(data.ltotalamt,1,2)}"></td>
+                    <td th:text="${data.ltotalcnt}"></td>
+                    <td th:text="${#numbers.formatDecimal(data.dtotalamt,1,2)}"></td>
+                    <td th:text="${data.dtotalcnt}"></td>
+                    <td th:text="${#numbers.formatDecimal(data.btotalamt+data.ltotalamt+data.dtotalamt,1,2)}"></td>
+                    <td th:text="${data.btotalcnt+data.ltotalcnt+data.dtotalcnt}"></td>
+                    <td th:text="${#numbers.formatDecimal(data.bpayamt,1,2)}"></td>
+                    <td th:text="${data.bpaycnt}"></td>
+                    <td th:text="${#numbers.formatDecimal(data.lpayamt,1,2)}"></td>
+                    <td th:text="${data.lpaycnt}"></td>
+                    <td th:text="${#numbers.formatDecimal(data.dpayamt,1,2)}"></td>
+                    <td th:text="${data.dpaycnt}"></td>
+                    <td th:text="${#numbers.formatDecimal(data.bpayamt+data.lpayamt+data.dpayamt,1,2)}"></td>
+                    <td th:text="${data.bpaycnt+data.lpaycnt+data.dpaycnt}"></td>
+                    <td th:text="${#numbers.formatDecimal(data.bfeeamt,1,2)}"></td>
+                    <td th:text="${#numbers.formatDecimal(data.lfeeamt,1,2)}"></td>
+                    <td th:text="${#numbers.formatDecimal(data.dfeeamt,1,2)}"></td>
+                    <td th:text="${#numbers.formatDecimal(data.bfeeamt+data.lfeeamt+data.dfeeamt,1,2)}"></td>
+
+                </tr>
+                <!--<tr th:if="${!dataStat.last}">
+                    <td th:text="${data.deptname}"></td>
+                    <td th:text="${#numbers.formatDecimal(data.btotalamt,1,2)}"></td>
+                    <td th:text="${data.btotalcnt}"></td>
+                    <td th:text="${#numbers.formatDecimal(data.ltotalamt,1,2)}"></td>
+                    <td th:text="${data.ltotalcnt}"></td>
+                    <td th:text="${#numbers.formatDecimal(data.dtotalamt,1,2)}"></td>
+                    <td th:text="${data.dtotalcnt}"></td>
+                    <td th:text="${#numbers.formatDecimal(data.btotalamt+data.ltotalamt+data.dtotalamt,1,2)}"></td>
+                    <td th:text="${data.btotalcnt+data.ltotalcnt+data.dtotalcnt}"></td>
+                    <td th:text="${#numbers.formatDecimal(data.bpayamt,1,2)}"></td>
+                    <td th:text="${data.bpaycnt}"></td>
+                    <td th:text="${#numbers.formatDecimal(data.lpayamt,1,2)}"></td>
+                    <td th:text="${data.lpaycnt}"></td>
+                    <td th:text="${#numbers.formatDecimal(data.dpayamt,1,2)}"></td>
+                    <td th:text="${data.dpaycnt}"></td>
+                    <td th:text="${#numbers.formatDecimal(data.bpayamt+data.lpayamt+data.dpayamt,1,2)}"></td>
+                    <td th:text="${data.bpaycnt+data.lpaycnt+data.dpaycnt}"></td>
+                    <td th:text="${#numbers.formatDecimal(data.bfeeamt,1,2)}"></td>
+                    <td th:text="${#numbers.formatDecimal(data.lfeeamt,1,2)}"></td>
+                    <td th:text="${#numbers.formatDecimal(data.dfeeamt,1,2)}"></td>
+                    <td th:text="${#numbers.formatDecimal(data.bfeeamt+data.lfeeamt+data.dfeeamt,1,2)}"></td>
+                </tr>-->
+                <tr th:if="${dataStat.last}">
+                    <td style="font-weight: bold;" th:text="${data.deptname}"></td>
+                    <td style="font-weight: bold;" th:text="${#numbers.formatDecimal(data.btotalamt,1,2)}"></td>
+                    <td style="font-weight: bold;" th:text="${data.btotalcnt}"></td>
+                    <td style="font-weight: bold;" th:text="${#numbers.formatDecimal(data.ltotalamt,1,2)}"></td>
+                    <td style="font-weight: bold;" th:text="${data.ltotalcnt}"></td>
+                    <td style="font-weight: bold;" th:text="${#numbers.formatDecimal(data.dtotalamt,1,2)}"></td>
+                    <td style="font-weight: bold;" th:text="${data.dtotalcnt}"></td>
+                    <td style="font-weight: bold;" th:text="${#numbers.formatDecimal(data.btotalamt+data.ltotalamt+data.dtotalamt,1,2)}"></td>
+                    <td style="font-weight: bold;" th:text="${data.btotalcnt+data.ltotalcnt+data.dtotalcnt}"></td>
+                    <td style="font-weight: bold;" th:text="${#numbers.formatDecimal(data.bpayamt,1,2)}"></td>
+                    <td style="font-weight: bold;" th:text="${data.bpaycnt}"></td>
+                    <td style="font-weight: bold;" th:text="${#numbers.formatDecimal(data.lpayamt,1,2)}"></td>
+                    <td style="font-weight: bold;" th:text="${data.lpaycnt}"></td>
+                    <td style="font-weight: bold;" th:text="${#numbers.formatDecimal(data.dpayamt,1,2)}"></td>
+                    <td style="font-weight: bold;" th:text="${data.dpaycnt}"></td>
+                    <td style="font-weight: bold;" th:text="${#numbers.formatDecimal(data.bpayamt+data.lpayamt+data.dpayamt,1,2)}"></td>
+                    <td style="font-weight: bold;" th:text="${data.bpaycnt+data.lpaycnt+data.dpaycnt}"></td>
+                    <td style="font-weight: bold;" th:text="${#numbers.formatDecimal(data.bfeeamt,1,2)}"></td>
+                    <td style="font-weight: bold;" th:text="${#numbers.formatDecimal(data.lfeeamt,1,2)}"></td>
+                    <td style="font-weight: bold;" th:text="${#numbers.formatDecimal(data.dfeeamt,1,2)}"></td>
+                    <td style="font-weight: bold;" th:text="${#numbers.formatDecimal(data.bfeeamt+data.lfeeamt+data.dfeeamt,1,2)}"></td>
+                </tr>
+            </div>
+            </tbody>
+        </table>
+    </div>
+</div>
+
+
+<script>
+    layui.use(['form', 'layer',  'element', 'laydate', 'treeSelect'], function () {
+        var form = layui.form;
+        var laydate = layui.laydate;
+        var treeSelect = layui.treeSelect;
+        var layer = layui.layer;
+        var $ = layui.jquery;
+
+        laydate.render({
+            elem: '#deptreport-search-startdate',
+            max: $("#deptreport-hidden-maxdate").val(),
+            trigger: 'click'
+        });
+        laydate.render({
+            elem: '#deptreport-search-enddate',
+            max: $("#deptreport-hidden-maxdate").val(),
+            trigger: 'click'
+        });
+
+        treeSelect.render({
+            elem: '#deptreport-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});
+                    $("#deptreport-search-devgroup").val("");
+                    treeSelect.revokeNode('deptreport-search-devgroup-filter');
+                    return false;
+                }
+                return true;
+            },
+            success: function (d) {
+                console.log(d); // 加载完成后的回调函数
+            }
+        });
+
+    
+        $('#deptreport-search-btn').click(function () {
+            var startdate = $("#deptreport-search-startdate").val();
+            var enddate = $("#deptreport-search-enddate").val();
+       //     var nodealshow = $("#deptreport-search-nodealshow").is(':checked');
+            var groupid=$("#deptreport-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;
+            }
+            if (null == groupid || "" == $.trim(groupid)) {
+                layer.msg('请选择设备组', {icon: 2, time: 1500});
+                return;
+            }
+            $.ajax({
+                url: '[[@{/deptreport/deptreportlist}]]',
+                type: "POST",
+                data: {
+                    startdate: startdate,
+                    enddate: enddate,
+                    groupid: groupid,
+                    _csrf: $("meta[name='_csrf_token']").attr("value")
+                },
+                success: function (data) {
+                    $("#shopreport-deptreport-table").html(data);
+                    layer.closeAll('loading');
+                },
+                error: function (status, err) {
+                    layer.closeAll('loading');
+                    layer.msg('查询失败了', {icon: 2});
+                }
+            });
+        });
+
+        $("#shopreport-deptreport-export-excel").click(function(){
+            var startdate= $("#shopreport-deptreport-tbody").attr("data-startdate");
+            var enddate= $("#shopreport-deptreport-tbody").attr("data-enddate");
+            var groupid= $("#shopreport-deptreport-tbody").attr("data-groupid");
+
+            var dataUrl='[[@{/deptreport/excelexportdeptreport}]]?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-deptreport-print-table").click(function(){
+            var startdate= $("#shopreport-deptreport-tbody").attr("data-startdate");
+            var enddate= $("#shopreport-deptreport-tbody").attr("data-enddate");
+            var groupid= $("#shopreport-deptreport-tbody").attr("data-groupid");
+            var opercode = $("#shopreport-deptreport-tbody").attr("data-opercode");
+            var url = '/deptreport/print/printdeptreport?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/deptreport/print/printdeptreport.html b/src/main/resources/templates/restaurant/deptreport/print/printdeptreport.html
new file mode 100644
index 0000000..0dda404
--- /dev/null
+++ b/src/main/resources/templates/restaurant/deptreport/print/printdeptreport.html
@@ -0,0 +1,167 @@
+<!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: 100px;">日期</th>
+                <th colspan="8" style="text-align: center;">消费正价</th>
+                <th colspan="8" style="text-align: center;">优惠后支付</th>
+                <th colspan="4" 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>
+                <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="23">无数据</td>
+            </tr>
+
+            <div th:remove="tag" th:if="${null!=showlist && showlist.size()>0}" th:each="data:${showlist}" >
+                <!-- <tr th:if=${!dataStat.last}>
+                     <td th:text="${childCount>0}?${data.datalist[0].checkdate}:''"></td>
+                     <td th:text="${childCount>0}?${#numbers.formatDecimal(data.datalist[0].btotalamt,1,2)}:''"></td>
+                     <td th:text="${childCount>0}?${data.datalist[0].btotalcnt}:''"></td>
+                     <td th:text="${childCount>0}?${#numbers.formatDecimal(data.datalist[0].ltotalamt,1,2)}:''"></td>
+                     <td th:text="${childCount>0}?${data.datalist[0].ltotalcnt}:''"></td>
+                     <td th:text="${childCount>0}?${#numbers.formatDecimal(data.datalist[0].dtotalamt,1,2)}:''"></td>
+                     <td th:text="${childCount>0}?${data.datalist[0].dtotalcnt}:''"></td>
+                     <td th:text="${childCount>0}?${#numbers.formatDecimal(data.datalist[0].ttotalamt,1,2)}:''"></td>
+                     <td th:text="${childCount>0}?${data.datalist[0].ttotalcnt}:''"></td>
+                     <td th:text="${childCount>0}?${#numbers.formatDecimal(data.datalist[0].bpayamt,1,2)}:''"></td>
+                     <td th:text="${childCount>0}?${data.datalist[0].bpaycnt}:''"></td>
+                     <td th:text="${childCount>0}?${#numbers.formatDecimal(data.datalist[0].lpayamt,1,2)}:''"></td>
+                     <td th:text="${childCount>0}?${data.datalist[0].lpaycnt}:''"></td>
+                     <td th:text="${childCount>0}?${#numbers.formatDecimal(data.datalist[0].dpayamt,1,2)}:''"></td>
+                     <td th:text="${childCount>0}?${data.datalist[0].dpaycnt}:''"></td>
+                     <td th:text="${childCount>0}?${#numbers.formatDecimal(data.datalist[0].tpayamt,1,2)}:''"></td>
+                     <td th:text="${childCount>0}?${data.datalist[0].tpaycnt}:''"></td>
+                     <td th:text="${childCount>0}?${#numbers.formatDecimal(data.datalist[0].bfeeamt,1,2)}:''"></td>
+                     <td th:text="${childCount>0}?${#numbers.formatDecimal(data.datalist[0].lfeeamt,1,2)}:''"></td>
+                     <td th:text="${childCount>0}?${#numbers.formatDecimal(data.datalist[0].dfeeamt,1,2)}:''"></td>
+                     <td th:text="${childCount>0}?${#numbers.formatDecimal(data.datalist[0].bfeeamt+data.datalist[0].lfeeamt+data.datalist[0].dfeeamt,1,2)}:''"></td>
+                 </tr>-->
+                <tr th:if="${!dataStat.last}">
+                    <td th:text="${data.deptname}"></td>
+                    <td th:text="${#numbers.formatDecimal(data.btotalamt,1,2)}"></td>
+                    <td th:text="${data.btotalcnt}"></td>
+                    <td th:text="${#numbers.formatDecimal(data.ltotalamt,1,2)}"></td>
+                    <td th:text="${data.ltotalcnt}"></td>
+                    <td th:text="${#numbers.formatDecimal(data.dtotalamt,1,2)}"></td>
+                    <td th:text="${data.dtotalcnt}"></td>
+                    <td th:text="${#numbers.formatDecimal(data.btotalamt+data.ltotalamt+data.dtotalamt,1,2)}"></td>
+                    <td th:text="${data.btotalcnt+data.ltotalcnt+data.dtotalcnt}"></td>
+                    <td th:text="${#numbers.formatDecimal(data.bpayamt,1,2)}"></td>
+                    <td th:text="${data.bpaycnt}"></td>
+                    <td th:text="${#numbers.formatDecimal(data.lpayamt,1,2)}"></td>
+                    <td th:text="${data.lpaycnt}"></td>
+                    <td th:text="${#numbers.formatDecimal(data.dpayamt,1,2)}"></td>
+                    <td th:text="${data.dpaycnt}"></td>
+                    <td th:text="${#numbers.formatDecimal(data.bpayamt+data.lpayamt+data.dpayamt,1,2)}"></td>
+                    <td th:text="${data.bpaycnt+data.lpaycnt+data.dpaycnt}"></td>
+                    <td th:text="${#numbers.formatDecimal(data.bfeeamt,1,2)}"></td>
+                    <td th:text="${#numbers.formatDecimal(data.lfeeamt,1,2)}"></td>
+                    <td th:text="${#numbers.formatDecimal(data.dfeeamt,1,2)}"></td>
+                    <td th:text="${#numbers.formatDecimal(data.bfeeamt+data.lfeeamt+data.dfeeamt,1,2)}"></td>
+                </tr>
+                <tr th:if="${dataStat.last}">
+                    <td style="font-weight: bold;" th:text="${data.deptname}"></td>
+                    <td style="font-weight: bold;" th:text="${#numbers.formatDecimal(data.btotalamt,1,2)}"></td>
+                    <td style="font-weight: bold;" th:text="${data.btotalcnt}"></td>
+                    <td style="font-weight: bold;" th:text="${#numbers.formatDecimal(data.ltotalamt,1,2)}"></td>
+                    <td style="font-weight: bold;" th:text="${data.ltotalcnt}"></td>
+                    <td style="font-weight: bold;" th:text="${#numbers.formatDecimal(data.dtotalamt,1,2)}"></td>
+                    <td style="font-weight: bold;" th:text="${data.dtotalcnt}"></td>
+                    <td style="font-weight: bold;" th:text="${#numbers.formatDecimal(data.btotalamt+data.ltotalamt+data.dtotalamt,1,2)}"></td>
+                    <td style="font-weight: bold;" th:text="${data.btotalcnt+data.ltotalcnt+data.dtotalcnt}"></td>
+                    <td style="font-weight: bold;" th:text="${#numbers.formatDecimal(data.bpayamt,1,2)}"></td>
+                    <td style="font-weight: bold;" th:text="${data.bpaycnt}"></td>
+                    <td style="font-weight: bold;" th:text="${#numbers.formatDecimal(data.lpayamt,1,2)}"></td>
+                    <td style="font-weight: bold;" th:text="${data.lpaycnt}"></td>
+                    <td style="font-weight: bold;" th:text="${#numbers.formatDecimal(data.dpayamt,1,2)}"></td>
+                    <td style="font-weight: bold;" th:text="${data.dpaycnt}"></td>
+                    <td style="font-weight: bold;" th:text="${#numbers.formatDecimal(data.bpayamt+data.lpayamt+data.dpayamt,1,2)}"></td>
+                    <td style="font-weight: bold;" th:text="${data.bpaycnt+data.lpaycnt+data.dpaycnt}"></td>
+                    <td style="font-weight: bold;" th:text="${#numbers.formatDecimal(data.bfeeamt,1,2)}"></td>
+                    <td style="font-weight: bold;" th:text="${#numbers.formatDecimal(data.lfeeamt,1,2)}"></td>
+                    <td style="font-weight: bold;" th:text="${#numbers.formatDecimal(data.dfeeamt,1,2)}"></td>
+                    <td style="font-weight: bold;" th:text="${#numbers.formatDecimal(data.bfeeamt+data.lfeeamt+data.dfeeamt,1,2)}"></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 colspan="2">&nbsp;</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