From ae2966471033c3e1c3771bc4d02d03d27f9642a6 Mon Sep 17 00:00:00 2001 From: lhb <495598773@qq.com> Date: Fri, 9 May 2025 09:22:38 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E8=B4=A2=E5=8A=A1-=E9=A4=90=E9=A5=AE?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=AF=BC=E5=87=BA=E7=BB=9F=E8=AE=A1=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RzRestaurantStatisticsController.java | 17 +++++++--- .../RzRestaurantStatisticsServiceImpl.java | 32 +++++++++++++------ .../impl/SysStaffDetailServiceImpl.java | 4 +-- 3 files changed, 38 insertions(+), 15 deletions(-) diff --git a/evo-admin/src/main/java/com/evo/restaurant/controller/RzRestaurantStatisticsController.java b/evo-admin/src/main/java/com/evo/restaurant/controller/RzRestaurantStatisticsController.java index 952e9bc..4610728 100644 --- a/evo-admin/src/main/java/com/evo/restaurant/controller/RzRestaurantStatisticsController.java +++ b/evo-admin/src/main/java/com/evo/restaurant/controller/RzRestaurantStatisticsController.java @@ -44,13 +44,22 @@ public class RzRestaurantStatisticsController extends BaseController return getDataTable(list); } + + @PostMapping("/export") + public void export(HttpServletResponse response,RzRestaurantStatistics rzRestaurantStatistics){ +// List list = rzRestaurantStatisticsService.selectRzRestaurantStatisticsListBySxs(rzRestaurantStatistics); + List res_list = rzRestaurantStatisticsService.selectRzRestaurantStatisticsList(rzRestaurantStatistics); + ExcelUtil util = new ExcelUtil(RzRestaurantStatistics.class); + util.exportExcel(response, res_list, "餐费明细表"); + } + /** * 导出餐饮统计列表 */ @PreAuthorize("@ss.hasPermi('restaurant:statistics:export')") @Log(title = "餐饮统计", businessType = BusinessType.EXPORT) - @GetMapping("/export") - public AjaxResult export(RzRestaurantStatistics rzRestaurantStatistics) + @GetMapping("/export0") + public AjaxResult export0(RzRestaurantStatistics rzRestaurantStatistics) { ExcelUtilCy util = new ExcelUtilCy(RzRestaurantStatistics.class); //创建总表 @@ -80,7 +89,7 @@ public class RzRestaurantStatisticsController extends BaseController vo_obj = new RzRestaurantStatistics(); res_obj = new RzRestaurantStatistics(); for (RzRestaurantStatistics restaurantStatistics : res_list) { - if(s.equals(restaurantStatistics.getCompanyName())){ + if(null!=restaurantStatistics && null!=restaurantStatistics.getCompanyName() && s.equals(restaurantStatistics.getCompanyName())){ if(null == vo_obj.getBreakfastNumber()){ vo_obj.setBreakfastNumber(0l); } @@ -214,7 +223,7 @@ public class RzRestaurantStatisticsController extends BaseController return util.exportExcel(list,lists,"总表",sheetNameList); } - @GetMapping("/exportkd") + @PostMapping("/exportkd") public void exportkd(HttpServletResponse response,RzRestaurantStatistics rzRestaurantStatistics){ List list = rzRestaurantStatisticsService.selectRzRestaurantStatisticsListBySxs(rzRestaurantStatistics); ExcelUtil util = new ExcelUtil(RzRestaurantStatistics.class); diff --git a/evo-admin/src/main/java/com/evo/restaurant/service/impl/RzRestaurantStatisticsServiceImpl.java b/evo-admin/src/main/java/com/evo/restaurant/service/impl/RzRestaurantStatisticsServiceImpl.java index 2e0441e..1144e0d 100644 --- a/evo-admin/src/main/java/com/evo/restaurant/service/impl/RzRestaurantStatisticsServiceImpl.java +++ b/evo-admin/src/main/java/com/evo/restaurant/service/impl/RzRestaurantStatisticsServiceImpl.java @@ -2,6 +2,7 @@ package com.evo.restaurant.service.impl; import com.evo.common.constant.Constants; import com.evo.common.core.domain.AjaxResult; +import com.evo.common.core.domain.entity.SysDept; import com.evo.common.core.domain.entity.SysDictData; import com.evo.common.utils.DateUtils; import com.evo.common.utils.StringUtils; @@ -65,7 +66,12 @@ public class RzRestaurantStatisticsServiceImpl implements IRzRestaurantStatistic { List res_list = rzRestaurantStatisticsMapper.selectRzRestaurantStatisticsList(rzRestaurantStatistics); for (RzRestaurantStatistics restaurantStatistics : res_list) { - restaurantStatistics.setCompanyName(deptMapper.selectDeptById(restaurantStatistics.getDeptId()).getDeptName()); + SysDept sysDept = deptMapper.selectDeptById(restaurantStatistics.getDeptId()); + if(null !=sysDept){ + restaurantStatistics.setCompanyName(sysDept.getDeptName()); + }else{ + restaurantStatistics.setCompanyName("实习生"); + } } return res_list; } @@ -124,11 +130,11 @@ public class RzRestaurantStatisticsServiceImpl implements IRzRestaurantStatistic return AjaxResult.error("请输入校正日期!!"); } //根据日期查询统计日期内的统计信息 - List rt_list = rzRestaurantStatisticsMapper.selectRzRestaurantStatisticsList(rzRestaurantStatistics); + List rt_list = rzRestaurantStatisticsMapper.selectRzRestaurantStatisticsList(rzRestaurantStatistics);//临时查询一条数据 //根据月份统计打卡信息 RzRestaurantDetail rzRestaurantDetail = new RzRestaurantDetail(); rzRestaurantDetail.setMonth(rzRestaurantStatistics.getMonth()); - List rd_list = rzRestaurantDetailMapper.selectRzRestaurantDetailList(rzRestaurantDetail); + List rd_list = rzRestaurantDetailMapper.selectRzRestaurantDetailList(rzRestaurantDetail);//临时查询一条数据 //查询消费情况 List dic_list = sysDictDataMapper.selectDictDataByType(Constants.SYS_RESTAUTANT); //循环统计信息 @@ -139,7 +145,15 @@ public class RzRestaurantStatisticsServiceImpl implements IRzRestaurantStatistic Long supper = 0l; //循环打卡详情 for (RzRestaurantDetail restaurantDetail : rd_list) { - if(restaurantStatistics.getStaffId() == restaurantDetail.getStaffId()){ + if(restaurantStatistics.getStaffId().equals(restaurantDetail.getStaffId())){ + SysStaffDetail sysStaffDetail = new SysStaffDetail(); + sysStaffDetail.setStaffId(restaurantDetail.getStaffId()); + List staffDetailList = sysStaffDetailMapper.selectSysStaffDetailList(sysStaffDetail); + if(null!=staffDetailList && staffDetailList.size()>0){ + restaurantStatistics.setBreakfastExpend(staffDetailList.get(0).getBreakfastExpend()); + restaurantStatistics.setLunchExpend(staffDetailList.get(0).getLunchExpend()); + restaurantStatistics.setSupperExpend(staffDetailList.get(0).getSupperExpend()); + } if("早餐".equals(restaurantDetail.getSign())){ breakfast += 1; continue; @@ -157,17 +171,17 @@ public class RzRestaurantStatisticsServiceImpl implements IRzRestaurantStatistic restaurantStatistics.setLunchNumber(lunch); restaurantStatistics.setSupperNumber(supper); //计算费用 - restaurantStatistics.setBreakfastPreSumExpend(restaurantStatistics.getBreakfastExpend().multiply(new BigDecimal(restaurantStatistics.getBreakfastNumber()))); + restaurantStatistics.setBreakfastPreSumExpend(restaurantStatistics.getBreakfastExpend().multiply(new BigDecimal(restaurantStatistics.getBreakfastNumber())));//个人消费 restaurantStatistics.setLunchPreSumExpend(restaurantStatistics.getLunchExpend().multiply(new BigDecimal(restaurantStatistics.getLunchNumber()))); restaurantStatistics.setSupperPreSumExpend(restaurantStatistics.getSupperExpend().multiply(new BigDecimal(restaurantStatistics.getSupperNumber()))); for (SysDictData sysDictData : dic_list) { - if(sysDictData.getDictLabel().indexOf("早餐") != -1){ - restaurantStatistics.setBreakfastSumExpend(new BigDecimal(sysDictData.getDictValue()).multiply(new BigDecimal(restaurantStatistics.getBreakfastNumber()))); + if(sysDictData.getDictLabel().indexOf("早餐消费") != -1){ + restaurantStatistics.setBreakfastSumExpend(new BigDecimal(sysDictData.getDictValue()).multiply(new BigDecimal(restaurantStatistics.getBreakfastNumber())));//总消费 } - if(sysDictData.getDictLabel().indexOf("午餐") != -1){ + if(sysDictData.getDictLabel().indexOf("午餐消费") != -1){ restaurantStatistics.setLunchSumExpend(new BigDecimal(sysDictData.getDictValue()).multiply(new BigDecimal(restaurantStatistics.getLunchNumber()))); } - if(sysDictData.getDictLabel().indexOf("晚餐") != -1){ + if(sysDictData.getDictLabel().indexOf("晚餐消费") != -1){ restaurantStatistics.setSupperSumExpend(new BigDecimal(sysDictData.getDictValue()).multiply(new BigDecimal(restaurantStatistics.getSupperNumber()))); } } diff --git a/evo-admin/src/main/java/com/evo/system/service/impl/SysStaffDetailServiceImpl.java b/evo-admin/src/main/java/com/evo/system/service/impl/SysStaffDetailServiceImpl.java index 7e5b166..9db03c6 100644 --- a/evo-admin/src/main/java/com/evo/system/service/impl/SysStaffDetailServiceImpl.java +++ b/evo-admin/src/main/java/com/evo/system/service/impl/SysStaffDetailServiceImpl.java @@ -88,7 +88,7 @@ public class SysStaffDetailServiceImpl implements ISysStaffDetailService } } }else { - //非住宿,月工资 + //非住宿,月工资==4,3,3 if(StringUtils.isNotNull(sysStaffDetail.getBasicSalary())){ for (SysDictData sysDictData : cy_list) { if("早餐消费".equals(sysDictData.getDictLabel())){ @@ -101,7 +101,7 @@ public class SysStaffDetailServiceImpl implements ISysStaffDetailService sysStaffDetail.setSupperExpend(new BigDecimal(sysDictData.getDictValue())); } } - }else{ + }else{//非住宿,日工资==4,3,8 for (SysDictData sysDictData : cy_list) { if("早餐消费".equals(sysDictData.getDictLabel())){ sysStaffDetail.setBreakfastExpend(new BigDecimal(sysDictData.getDictValue()));