From 9bd8d9e8a2dd96c67a2af5406ca00b34404a8ae7 Mon Sep 17 00:00:00 2001 From: andy <1042025947@qq.com> Date: Tue, 17 Jun 2025 14:18:07 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=A4=90=E9=A5=AE=E7=94=9F?= =?UTF-8?q?=E6=88=90=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../evo/common/controller/TestController.java | 33 +++++++++- ...yCalculationStrategyExchangeProcessor.java | 1 + ...onthlySalaryStrategyExchangeProcessor.java | 2 + .../impl/RzSalaryDetailServiceImpl.java | 11 ---- .../domain/RzRestaurantStatistics.java | 1 + .../IRzRestaurantStatisticsService.java | 16 +++-- .../impl/RzRestaurantImagesServiceImpl.java | 16 +---- .../RzRestaurantStatisticsServiceImpl.java | 66 +++++++++---------- .../service/impl/SysStaffServiceImpl.java | 57 ++++++++-------- .../java/com/evo/task/TaskController.java | 19 +++++- 10 files changed, 121 insertions(+), 101 deletions(-) diff --git a/evo-admin/src/main/java/com/evo/common/controller/TestController.java b/evo-admin/src/main/java/com/evo/common/controller/TestController.java index b58809c..19920a7 100644 --- a/evo-admin/src/main/java/com/evo/common/controller/TestController.java +++ b/evo-admin/src/main/java/com/evo/common/controller/TestController.java @@ -1,20 +1,30 @@ package com.evo.common.controller; import com.alibaba.fastjson2.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.evo.attendance.service.IRzAttendanceStatisticalService; import com.evo.common.core.domain.AjaxResult; import com.evo.common.core.page.TableDataInfo; +import com.evo.common.utils.Collections; import com.evo.common.utils.ParamUtils; import com.evo.finance.domain.RzSalaryDetail; import com.evo.personnelMatters.domain.RzOverTimeDetail; import com.evo.personnelMatters.mapper.RzOverTimeDetailMapper; import com.evo.personnelMatters.mapper.RzOverTimeMapper; +import com.evo.restaurant.service.IRzRestaurantStatisticsService; +import com.evo.system.domain.SysStaff; +import com.evo.system.service.ISysStaffService; +import com.evo.system.service.impl.SysStaffServiceImpl; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import java.math.BigDecimal; +import java.text.ParseException; +import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; @@ -34,7 +44,12 @@ public class TestController { private RzOverTimeMapper rzOverTimeMapper; @Resource private RzOverTimeDetailMapper rzOverTimeDetailMapper; - + @Resource + private ISysStaffService sysStaffService; + @Resource + IRzAttendanceStatisticalService rzAttendanceStatisticalService; + @Resource + IRzRestaurantStatisticsService rzRestaurantStatisticsService; /** * 清洗加班 */ @@ -59,4 +74,20 @@ public class TestController { return AjaxResult.success(); } + + + /** + * 清洗加班 + */ + @PostMapping("/attendanceStatistical") + public AjaxResult attendanceStatistical(String userIds, String date) throws ParseException { + Date d = new SimpleDateFormat("yyyy-MM-dd").parse(date); + for (SysStaff sysStaff : sysStaffService.list(new LambdaQueryWrapper().in(SysStaff::getUserId, Collections.asList(userIds.split(","))))){ + rzAttendanceStatisticalService.createRzAttendance(sysStaff, null, d); + rzRestaurantStatisticsService.createRestaurantStatistics(sysStaff, d); + } + + return AjaxResult.success(); + } + } diff --git a/evo-admin/src/main/java/com/evo/finance/processor/SalaryCalculationStrategyExchangeProcessor.java b/evo-admin/src/main/java/com/evo/finance/processor/SalaryCalculationStrategyExchangeProcessor.java index f861f3f..3934108 100644 --- a/evo-admin/src/main/java/com/evo/finance/processor/SalaryCalculationStrategyExchangeProcessor.java +++ b/evo-admin/src/main/java/com/evo/finance/processor/SalaryCalculationStrategyExchangeProcessor.java @@ -182,6 +182,7 @@ public interface SalaryCalculationStrategyExchangeProcessor { * 计算扣款 */ default void deduction(Boolean isDk, SysStaffDetail detail, RzSalaryDetail rzSalaryDetail, BigDecimal ycHours , BigDecimal cqHours){ + System.out.println(detail.getStaffId()); //其他扣款 rzSalaryDetail.setDeductions(detail.getDeductions()); //餐饮扣款 diff --git a/evo-admin/src/main/java/com/evo/finance/processor/impl/MonthlySalaryStrategyExchangeProcessor.java b/evo-admin/src/main/java/com/evo/finance/processor/impl/MonthlySalaryStrategyExchangeProcessor.java index 71c5ef2..f60eea0 100644 --- a/evo-admin/src/main/java/com/evo/finance/processor/impl/MonthlySalaryStrategyExchangeProcessor.java +++ b/evo-admin/src/main/java/com/evo/finance/processor/impl/MonthlySalaryStrategyExchangeProcessor.java @@ -1,5 +1,6 @@ package com.evo.finance.processor.impl; +import com.alibaba.fastjson2.JSON; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.evo.attendance.domain.RzAttendance; import com.evo.attendance.domain.RzAttendanceStatistical; @@ -68,6 +69,7 @@ public class MonthlySalaryStrategyExchangeProcessor implements SalaryCalculation @Override public void monthSalary(Date limitMonth, Date month, Date limitDate ,SysStaff sysStaff, SysStaffDetail detail, RzSalaryDetail rzSalaryDetail, RzAttendanceStatistical attendanceStatistical){ //如果计算薪资的月份 小于转正的月份, 则按照全额薪资的80%发放 + System.out.println(JSON.toJSONString(sysStaff)); BigDecimal workHourPrice = rzSalaryDetail.getBasicSalary().add(rzSalaryDetail.getJobSalary()).divide(attendanceStatistical.getShouldAttendance(),2, RoundingMode.HALF_UP); if(limitMonth.compareTo(month) > 0){ rzSalaryDetail.setMonthSalary(rzSalaryDetail.getBasicSalary().add(rzSalaryDetail.getJobSalary()).multiply(new BigDecimal(Constants.SUBSIDY_PERIOD))); diff --git a/evo-admin/src/main/java/com/evo/finance/service/impl/RzSalaryDetailServiceImpl.java b/evo-admin/src/main/java/com/evo/finance/service/impl/RzSalaryDetailServiceImpl.java index 2efc496..87b7def 100644 --- a/evo-admin/src/main/java/com/evo/finance/service/impl/RzSalaryDetailServiceImpl.java +++ b/evo-admin/src/main/java/com/evo/finance/service/impl/RzSalaryDetailServiceImpl.java @@ -638,17 +638,6 @@ public class RzSalaryDetailServiceImpl extends ServiceImpl sheetCompanyNames = Collections.asList("外包","石家庄辰宙","河北伊特").stream().sorted((x,y) -> { - if(x.equals("河北伊特")){ - return -1; - }else{ - return x.compareTo(y); - } - }).collect(Collectors.toList()); - System.out.println(JSON.toJSONString(sheetCompanyNames)); - } - @Override public AjaxResult export(RzSalaryDetail rzSalaryDetail) { ExcelUtilSs util = new ExcelUtilSs(SalaryVo.class); diff --git a/evo-admin/src/main/java/com/evo/restaurant/domain/RzRestaurantStatistics.java b/evo-admin/src/main/java/com/evo/restaurant/domain/RzRestaurantStatistics.java index 433920e..98aa792 100644 --- a/evo-admin/src/main/java/com/evo/restaurant/domain/RzRestaurantStatistics.java +++ b/evo-admin/src/main/java/com/evo/restaurant/domain/RzRestaurantStatistics.java @@ -31,6 +31,7 @@ public class RzRestaurantStatistics extends BaseEntity private Long staffId; private Long deptId; @Excel(name = "公司名称") + @TableField(exist = false) private String companyName; //公司名称 /** 姓名 */ @Excel(name = "姓名") diff --git a/evo-admin/src/main/java/com/evo/restaurant/service/IRzRestaurantStatisticsService.java b/evo-admin/src/main/java/com/evo/restaurant/service/IRzRestaurantStatisticsService.java index 5c47a2f..b09cb29 100644 --- a/evo-admin/src/main/java/com/evo/restaurant/service/IRzRestaurantStatisticsService.java +++ b/evo-admin/src/main/java/com/evo/restaurant/service/IRzRestaurantStatisticsService.java @@ -1,7 +1,11 @@ package com.evo.restaurant.service; import com.evo.common.core.domain.AjaxResult; +import com.evo.restaurant.domain.RzRestaurantImages; import com.evo.restaurant.domain.RzRestaurantStatistics; +import com.evo.system.domain.SysStaff; + +import java.util.Date; import java.util.List; /** @@ -28,12 +32,6 @@ public interface IRzRestaurantStatisticsService */ public List selectRzRestaurantStatisticsList(RzRestaurantStatistics rzRestaurantStatistics); - /** - * 新增餐饮统计 - * @return 结果 - */ - public void insertRzRestaurantStatistics(); - /** * 校正数据 * @return @@ -48,4 +46,10 @@ public interface IRzRestaurantStatisticsService public AjaxResult export(RzRestaurantStatistics rzRestaurantStatistics); + + void createRestaurantStatistics(SysStaff sysStaff, Date date); + + void createRestaurantStatistics(RzRestaurantImages restaurantImages, Date date); + + } diff --git a/evo-admin/src/main/java/com/evo/restaurant/service/impl/RzRestaurantImagesServiceImpl.java b/evo-admin/src/main/java/com/evo/restaurant/service/impl/RzRestaurantImagesServiceImpl.java index f135c41..fe17293 100644 --- a/evo-admin/src/main/java/com/evo/restaurant/service/impl/RzRestaurantImagesServiceImpl.java +++ b/evo-admin/src/main/java/com/evo/restaurant/service/impl/RzRestaurantImagesServiceImpl.java @@ -19,6 +19,7 @@ import com.evo.restaurant.domain.RzRestaurantStatistics; import com.evo.restaurant.mapper.RzRestaurantImagesMapper; import com.evo.restaurant.mapper.RzRestaurantStatisticsMapper; import com.evo.restaurant.service.IRzRestaurantImagesService; +import com.evo.restaurant.service.IRzRestaurantStatisticsService; import com.evo.system.service.RzUploadService; import org.apache.commons.lang3.ObjectUtils; import org.springframework.stereotype.Service; @@ -39,7 +40,7 @@ import java.util.List; public class RzRestaurantImagesServiceImpl extends ServiceImpl implements IRzRestaurantImagesService { @Resource - private RzRestaurantStatisticsMapper rzRestaurantStatisticsMapper; //餐饮统计 + private IRzRestaurantStatisticsService rzRestaurantStatisticsService; //餐饮统计 @Resource private IEqSnDetailService eqSnDetailService;//餐饮统计 @Resource @@ -121,18 +122,7 @@ public class RzRestaurantImagesServiceImpl extends ServiceImpl st_list = sysStaffMapper.selectSysStaffListAll(); - //查询员工的详细信息 - RzRestaurantStatistics rzRestaurantStatistics = null; - for (SysStaff sysStaff : st_list) { - rzRestaurantStatistics = new RzRestaurantStatistics(); - rzRestaurantStatistics.setStaffId(sysStaff.getUserId()); - rzRestaurantStatistics.setDeptId(sysStaff.getDeptId()); - rzRestaurantStatistics.setName(sysStaff.getName()); - rzRestaurantStatistics.setMonth(DateUtils.getNowDate()); - //查询早午晚三餐消费 - getBaseMapper().insert(rzRestaurantStatistics); - } - //获取只吃饭不打卡的职员工 - List img_list = rzRestaurantImagesMapper.selectRzRestaurantImagesList(null); - for (RzRestaurantImages rzRestaurantImages : img_list) { - rzRestaurantStatistics = new RzRestaurantStatistics(); - rzRestaurantStatistics.setStaffId(rzRestaurantImages.getId()); - rzRestaurantStatistics.setName(rzRestaurantImages.getName()); - rzRestaurantStatistics.setMonth(DateUtils.getNowDate()); - getBaseMapper().insertRzRestaurantStatistics(rzRestaurantStatistics); - } - } @@ -260,4 +226,32 @@ public class RzRestaurantStatisticsServiceImpl extends ServiceImpl i @Resource private IRzAttendanceStatisticalService rzAttendanceStatisticalService; //考勤统计 @Resource - private RzRestaurantStatisticsMapper rzRestaurantStatisticsMapper; //餐饮统计 + private IRzRestaurantStatisticsService rzRestaurantStatisticsService; //餐饮统计 @Resource private RzUploadService rzUploadService;//文件上传 @Resource @@ -156,7 +157,7 @@ public class SysStaffServiceImpl extends ServiceImpl i //打卡统计,打卡详情 rzAttendanceStatisticalService.createRzAttendance(sysStaff, Collections.emptyList(), null); //处理餐饮信息 - createRestaurantStatistics(sysStaff); + rzRestaurantStatisticsService.createRestaurantStatistics(sysStaff, DateUtils.getNowDate()); //处理考勤机相关信息 initCheckDevice(sysStaff); return AjaxResult.success(); @@ -204,32 +205,26 @@ public class SysStaffServiceImpl extends ServiceImpl i * 创建餐饮统计 * @param sysStaff */ - private void createRestaurantStatistics(SysStaff sysStaff){ - RzRestaurantStatistics rzRestaurantStatistics = rzRestaurantStatisticsMapper.selectRzRestaurantStatisticsByUserIdAndDate(sysStaff.getUserId(),DateUtils.getNowDate()); - if(StringUtils.isNotNull(rzRestaurantStatistics)){ - rzRestaurantStatistics.setCompanyName(sysStaff.getCompanyName()); - rzRestaurantStatistics.setDeptId(sysStaff.getDeptId()); - rzRestaurantStatistics.setName(sysStaff.getName()); - rzRestaurantStatisticsMapper.updateRzRestaurantStatistics(rzRestaurantStatistics); - return; - } - rzRestaurantStatistics = new RzRestaurantStatistics(); - rzRestaurantStatistics.setName(sysStaff.getName()); - rzRestaurantStatistics.setCompanyName(sysStaff.getCompanyName()); - rzRestaurantStatistics.setDeptId(sysStaff.getDeptId()); - rzRestaurantStatistics.setStaffId(sysStaff.getUserId()); - rzRestaurantStatistics.setMonth(DateUtils.getNowDate()); - SysStaffDetail sysStaffDetail = sysStaffDetailMapper.selectSysStaffDetailByStaffId(sysStaff.getUserId()); - if(StringUtils.isNotNull(sysStaffDetail)){ -// rzRestaurantStatistics.setBreakfastExpend(sysStaffDetail.getBreakfastExpend()); -// rzRestaurantStatistics.setLunchExpend(sysStaffDetail.getLunchExpend()); -// rzRestaurantStatistics.setSupperExpend(sysStaffDetail.getSupperExpend()); - } - rzRestaurantStatistics.setDelFlag(Constants.DELETE_FLAG_0); - rzRestaurantStatistics.setCreateBy(SecurityUtils.getUsername()); - rzRestaurantStatistics.setCreateTime(DateUtils.getNowDate()); - rzRestaurantStatisticsMapper.insertRzRestaurantStatistics(rzRestaurantStatistics); - } +// private void createRestaurantStatistics(SysStaff sysStaff){ +// RzRestaurantStatistics rzRestaurantStatistics = rzRestaurantStatisticsMapper.selectRzRestaurantStatisticsByUserIdAndDate(sysStaff.getUserId(),DateUtils.getNowDate()); +// if(StringUtils.isNotNull(rzRestaurantStatistics)){ +// rzRestaurantStatistics.setCompanyName(sysStaff.getCompanyName()); +// rzRestaurantStatistics.setDeptId(sysStaff.getDeptId()); +// rzRestaurantStatistics.setName(sysStaff.getName()); +// rzRestaurantStatisticsMapper.updateRzRestaurantStatistics(rzRestaurantStatistics); +// return; +// } +// rzRestaurantStatistics = new RzRestaurantStatistics(); +// rzRestaurantStatistics.setName(sysStaff.getName()); +// rzRestaurantStatistics.setCompanyName(sysStaff.getCompanyName()); +// rzRestaurantStatistics.setDeptId(sysStaff.getDeptId()); +// rzRestaurantStatistics.setStaffId(sysStaff.getUserId()); +// rzRestaurantStatistics.setMonth(DateUtils.getNowDate()); +// rzRestaurantStatistics.setDelFlag(Constants.DELETE_FLAG_0); +// rzRestaurantStatistics.setCreateBy(SecurityUtils.getUsername()); +// rzRestaurantStatistics.setCreateTime(DateUtils.getNowDate()); +// rzRestaurantStatisticsMapper.insertRzRestaurantStatistics(rzRestaurantStatistics); +// } /** * 修改员工管理 * @@ -316,7 +311,7 @@ public class SysStaffServiceImpl extends ServiceImpl i //修改考勤统计 rzAttendanceStatisticalService.createRzAttendance(sysStaff, Collections.emptyList(), null); //餐饮统计 - createRestaurantStatistics(sysStaff); + rzRestaurantStatisticsService.createRestaurantStatistics(sysStaff, DateUtils.getNowDate()); //处理考勤机相关信息 initCheckDevice(sysStaff); // } @@ -347,7 +342,7 @@ public class SysStaffServiceImpl extends ServiceImpl i //修改考勤统计 rzAttendanceStatisticalService.createRzAttendance(sysStaff, Collections.emptyList(), null); //餐饮统计 - createRestaurantStatistics(sysStaff); + rzRestaurantStatisticsService.createRestaurantStatistics(sysStaff, DateUtils.getNowDate()); } /** * 删除员工管理信息 @@ -842,7 +837,7 @@ public class SysStaffServiceImpl extends ServiceImpl i } rzAttendanceStatisticalService.createRzAttendance(sysStaff, Collections.emptyList(), null); //餐饮统计 - createRestaurantStatistics(sysStaff); + rzRestaurantStatisticsService.createRestaurantStatistics(sysStaff, DateUtils.getNowDate()); } } catch (Exception e){ e.printStackTrace(); diff --git a/evo-admin/src/main/java/com/evo/task/TaskController.java b/evo-admin/src/main/java/com/evo/task/TaskController.java index 959cc18..105f4d8 100644 --- a/evo-admin/src/main/java/com/evo/task/TaskController.java +++ b/evo-admin/src/main/java/com/evo/task/TaskController.java @@ -1,18 +1,20 @@ package com.evo.task; import com.evo.attendance.service.IRzAbnormalDetailService; -import com.evo.attendance.service.IRzAttendanceService; import com.evo.attendance.service.IRzAttendanceStatisticalService; import com.evo.common.utils.DateUtils; -import com.evo.equipment.service.IEqSnDetailService; +import com.evo.restaurant.domain.RzRestaurantImages; import com.evo.restaurant.domain.RzRestaurantStatistics; +import com.evo.restaurant.service.IRzRestaurantImagesService; import com.evo.restaurant.service.IRzRestaurantStatisticsService; +import com.evo.system.domain.SysStaff; import com.evo.system.service.ISysStaffService; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import javax.annotation.Resource; import java.util.Date; +import java.util.List; @Component public class TaskController { @@ -25,6 +27,8 @@ public class TaskController { private IRzAbnormalDetailService abnormalDetailService; @Resource private IRzAttendanceStatisticalService rzAttendanceStatisticalService; + @Resource + private IRzRestaurantImagesService rzRestaurantImagesService; /** * 每月1号 0:20 自动生成考勤数据 */ @@ -38,7 +42,16 @@ public class TaskController { */ @Scheduled(cron = "0 0 1 1 * ?") public void insertRzRestaurantStatistics(){ - rzRestaurantStatisticsService.insertRzRestaurantStatistics(); + List st_list = sysStaffService.selectSysStaffListAll(); + Date date = DateUtils.getNowDate(); + for (SysStaff sysStaff : st_list) { + rzRestaurantStatisticsService.createRestaurantStatistics(sysStaff, date); + } +// //获取只吃饭不打卡的职员工 + List img_list = rzRestaurantImagesService.selectRzRestaurantImagesList(null); + for (RzRestaurantImages rzRestaurantImages : img_list) { + rzRestaurantStatisticsService.createRestaurantStatistics(rzRestaurantImages, date); + } } /**