调整餐饮生成接口

This commit is contained in:
andy 2025-06-17 14:18:07 +08:00
parent 3cbae22354
commit 9bd8d9e8a2
10 changed files with 121 additions and 101 deletions

View File

@ -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<SysStaff>().in(SysStaff::getUserId, Collections.asList(userIds.split(","))))){
rzAttendanceStatisticalService.createRzAttendance(sysStaff, null, d);
rzRestaurantStatisticsService.createRestaurantStatistics(sysStaff, d);
}
return AjaxResult.success();
}
}

View File

@ -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());
//餐饮扣款

View File

@ -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)));

View File

@ -638,17 +638,6 @@ public class RzSalaryDetailServiceImpl extends ServiceImpl<RzSalaryDetailMapper,
return result;
}
public static void main(String[] args) {
List<String> 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<SalaryVo> util = new ExcelUtilSs<SalaryVo>(SalaryVo.class);

View File

@ -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 = "姓名")

View File

@ -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<RzRestaurantStatistics> 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);
}

View File

@ -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<RzRestaurantImagesMapper, RzRestaurantImages> implements IRzRestaurantImagesService
{
@Resource
private RzRestaurantStatisticsMapper rzRestaurantStatisticsMapper; //餐饮统计
private IRzRestaurantStatisticsService rzRestaurantStatisticsService; //餐饮统计
@Resource
private IEqSnDetailService eqSnDetailService;//餐饮统计
@Resource
@ -121,18 +122,7 @@ public class RzRestaurantImagesServiceImpl extends ServiceImpl<RzRestaurantImage
if(i < 1){
return AjaxResult.error();
}
//餐饮统计
RzRestaurantStatistics rzRestaurantStatistics = new RzRestaurantStatistics();
rzRestaurantStatistics.setStaffId(rzRestaurantImages.getId());
rzRestaurantStatistics.setName(rzRestaurantImages.getName());
rzRestaurantStatistics.setMonth(DateUtils.getNowDate());
rzRestaurantStatistics.setCreateTime(DateUtils.getNowDate());
rzRestaurantStatistics.setDelFlag(Constants.DELETE_FLAG_0);
rzRestaurantStatistics.setCreateBy(SecurityUtils.getUsername());
i = rzRestaurantStatisticsMapper.insertRzRestaurantStatistics(rzRestaurantStatistics);
if(i < 1){
return AjaxResult.error();
}
rzRestaurantStatisticsService.createRestaurantStatistics(rzRestaurantImages, DateUtils.getNowDate());
}
if(ObjectUtils.isNotEmpty(rzRestaurantImages.getFileId())){
RzUpload upload = null;

View File

@ -7,6 +7,7 @@ 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.*;
import com.evo.common.utils.Collections;
import com.evo.restaurant.domain.RzRestaurantDetail;
import com.evo.restaurant.domain.RzRestaurantImages;
import com.evo.restaurant.domain.RzRestaurantStatistics;
@ -24,10 +25,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -46,8 +44,6 @@ public class RzRestaurantStatisticsServiceImpl extends ServiceImpl<RzRestaurantS
@Resource
private SysStaffDetailMapper sysStaffDetailMapper; //员工详情
@Resource
private RzRestaurantImagesMapper rzRestaurantImagesMapper; //研究生人员
@Resource
private SysDictDataMapper sysDictDataMapper; //数据字典
@Resource
private RzRestaurantDetailMapper rzRestaurantDetailMapper; //餐饮详情
@ -95,36 +91,6 @@ public class RzRestaurantStatisticsServiceImpl extends ServiceImpl<RzRestaurantS
// }
// return res_list;
}
/**
* 新增餐饮统计
* @return 结果
*/
@Override
public void insertRzRestaurantStatistics()
{
//获取在职员工
List<SysStaff> 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<RzRestaurantImages> 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<RzRestaurantS
return util.exportExcel(allList,lists,"总表",dataList.keySet().stream().collect(Collectors.toList()));
}
@Override
public void createRestaurantStatistics(SysStaff sysStaff, Date date) {
create(sysStaff.getUserId(), sysStaff.getDeptId(), sysStaff.getName(), date);
}
@Override
public void createRestaurantStatistics(RzRestaurantImages restaurantImages, Date date) {
create(restaurantImages.getId(), null, restaurantImages.getName(), date);
}
private void create(Long staffId, Long deptId, String name, Date date){
RzRestaurantStatistics rzRestaurantStatistics = getBaseMapper().selectRzRestaurantStatisticsByUserIdAndDate(staffId,date);
if(StringUtils.isNotNull(rzRestaurantStatistics)){
rzRestaurantStatistics.setDeptId(deptId);
rzRestaurantStatistics.setName(name);
getBaseMapper().updateRzRestaurantStatistics(rzRestaurantStatistics);
return;
}
rzRestaurantStatistics = new RzRestaurantStatistics();
rzRestaurantStatistics.setName(name);
rzRestaurantStatistics.setDeptId(deptId);
rzRestaurantStatistics.setStaffId(staffId);
rzRestaurantStatistics.setMonth(date);
rzRestaurantStatistics.setDelFlag(Constants.DELETE_FLAG_0);
getBaseMapper().insert(rzRestaurantStatistics);
}
}

View File

@ -19,6 +19,7 @@ import com.evo.common.utils.bean.BeanUtils;
import com.evo.equipment.service.IEqSnDetailService;
import com.evo.restaurant.domain.RzRestaurantStatistics;
import com.evo.restaurant.mapper.RzRestaurantStatisticsMapper;
import com.evo.restaurant.service.IRzRestaurantStatisticsService;
import com.evo.system.domain.SysStaff;
import com.evo.system.domain.SysStaffDetail;
import com.evo.system.domain.vo.SysStaffVo;
@ -68,7 +69,7 @@ public class SysStaffServiceImpl extends ServiceImpl<SysStaffMapper, SysStaff> 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<SysStaffMapper, SysStaff> 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<SysStaffMapper, SysStaff> 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<SysStaffMapper, SysStaff> 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<SysStaffMapper, SysStaff> i
//修改考勤统计
rzAttendanceStatisticalService.createRzAttendance(sysStaff, Collections.emptyList(), null);
//餐饮统计
createRestaurantStatistics(sysStaff);
rzRestaurantStatisticsService.createRestaurantStatistics(sysStaff, DateUtils.getNowDate());
}
/**
* 删除员工管理信息
@ -842,7 +837,7 @@ public class SysStaffServiceImpl extends ServiceImpl<SysStaffMapper, SysStaff> i
}
rzAttendanceStatisticalService.createRzAttendance(sysStaff, Collections.emptyList(), null);
//餐饮统计
createRestaurantStatistics(sysStaff);
rzRestaurantStatisticsService.createRestaurantStatistics(sysStaff, DateUtils.getNowDate());
}
} catch (Exception e){
e.printStackTrace();

View File

@ -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号 020 自动生成考勤数据
*/
@ -38,7 +42,16 @@ public class TaskController {
*/
@Scheduled(cron = "0 0 1 1 * ?")
public void insertRzRestaurantStatistics(){
rzRestaurantStatisticsService.insertRzRestaurantStatistics();
List<SysStaff> st_list = sysStaffService.selectSysStaffListAll();
Date date = DateUtils.getNowDate();
for (SysStaff sysStaff : st_list) {
rzRestaurantStatisticsService.createRestaurantStatistics(sysStaff, date);
}
// //获取只吃饭不打卡的职员工
List<RzRestaurantImages> img_list = rzRestaurantImagesService.selectRzRestaurantImagesList(null);
for (RzRestaurantImages rzRestaurantImages : img_list) {
rzRestaurantStatisticsService.createRestaurantStatistics(rzRestaurantImages, date);
}
}
/**