工资表导出新增 河北伊特汇总表, 部门人数表
餐饮管理系统 增加详情信息维护 考勤系统增加, 超过3天未打卡 异常提醒 新增餐厅费用维护模块, 用于维护 招待费, 福利费 餐券 水电费, 燃气费等
This commit is contained in:
parent
78c21667a1
commit
17dfbda424
@ -6,6 +6,7 @@ import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 考勤明细Mapper接口
|
||||
@ -73,4 +74,6 @@ public interface RzAttendanceDetailMapper extends BaseMapper<RzAttendanceDetail>
|
||||
* @return 考勤明细集合
|
||||
*/
|
||||
public RzAttendanceDetail selectLastRzAttendanceDetailByBk(@Param("staffId") Long staffId, @Param("buttonType") String buttonType, @Param("startDateTime") Date startDateTime, @Param("endDateTime") Date endDateTime);
|
||||
|
||||
List<Map<String,Object>> getThreeDayNotCheck();
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@ import com.evo.attendance.domain.RzAttendanceDetail;
|
||||
import com.evo.attendance.domain.vo.RzAttendanceDetailTimeLineVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@ -31,4 +32,7 @@ public interface RzAttendanceDetailService extends IService<RzAttendanceDetail>
|
||||
public RzAttendanceDetail selectLastWorkCardByStaffId(@Param("staffId") Long staffId);
|
||||
|
||||
public List<RzAttendanceDetailTimeLineVO> selectListByAttendanceId(Long attId);
|
||||
|
||||
public void sendAttendanceDetail() throws ParseException;
|
||||
|
||||
}
|
||||
|
||||
@ -8,12 +8,31 @@ import com.evo.attendance.domain.vo.RzAttendanceDetailTimeLineVO;
|
||||
import com.evo.attendance.mapper.RzAttendanceDetailMapper;
|
||||
import com.evo.attendance.service.RzAttendanceDetailService;
|
||||
import com.evo.common.constant.Constants;
|
||||
import com.evo.common.core.domain.entity.SysDept;
|
||||
import com.evo.common.utils.Collections;
|
||||
import com.evo.common.utils.DateUtils;
|
||||
import com.evo.common.utils.ParamUtils;
|
||||
import com.evo.common.utils.StringUtils;
|
||||
import com.evo.personnelMatters.domain.RzLeaveDetail;
|
||||
import com.evo.personnelMatters.mapper.RzLeaveDetailMapper;
|
||||
import com.evo.system.domain.SysStaff;
|
||||
import com.evo.system.mapper.SysDeptMapper;
|
||||
import com.evo.system.mapper.SysStaffMapper;
|
||||
import com.evo.wechat.service.SendClientService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@ -25,8 +44,17 @@ import java.util.stream.Collectors;
|
||||
* @contact: 17330188597
|
||||
* @remark: 开发人员联系方式 1042025947@qq.com/微信同步
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class RzAttendanceDetailServiceImpl extends ServiceImpl<RzAttendanceDetailMapper, RzAttendanceDetail> implements RzAttendanceDetailService {
|
||||
@Autowired
|
||||
private SysDeptMapper sysDeptMapper;
|
||||
@Resource
|
||||
private SendClientService sendClientService;
|
||||
@Autowired
|
||||
RzLeaveDetailMapper rzLeaveDetailMapper;
|
||||
@Autowired
|
||||
private SysStaffMapper sysStaffMapper;
|
||||
|
||||
@Override
|
||||
public RzAttendanceDetail addDetail(RzAttendance attendance, String rules, String sn, Date date, String remark) {
|
||||
@ -94,4 +122,101 @@ public class RzAttendanceDetailServiceImpl extends ServiceImpl<RzAttendanceDetai
|
||||
return new RzAttendanceDetailTimeLineVO(data.getButtonType(), DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",data.getDateTime()), data.getDelFlag());
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
SimpleDateFormat sdfd = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
@Override
|
||||
public void sendAttendanceDetail() throws ParseException {
|
||||
//查询所有上次打开时间距今天超过3天的员工信息
|
||||
List<Map<String, Object>> threeDayNotCheckList = super.getBaseMapper().getThreeDayNotCheck();
|
||||
if(Collections.isNotEmpty(threeDayNotCheckList)){
|
||||
for (Map<String, Object> threeDayNotCheck : threeDayNotCheckList){
|
||||
//用户Id
|
||||
Integer userId = Integer.valueOf(String.valueOf(threeDayNotCheck.get("userId")));
|
||||
//最后打卡时间
|
||||
System.out.println(threeDayNotCheck.get("lastDate"));
|
||||
Date lastDateTme = DateUtils.parseDate(String.valueOf(threeDayNotCheck.get("lastDate")), "yyyy-MM-dd");
|
||||
//首先获取最后打卡时间到今天的所有天数
|
||||
List<String> holidayDates = Collections.emptyList();
|
||||
//记录所有时间的年, 防止有跨年的情况
|
||||
List<String> yearList = Collections.emptyList();
|
||||
Date currentDate = new Date();
|
||||
while (lastDateTme.compareTo(currentDate) <= 0){
|
||||
String date = sdfd.format(lastDateTme);
|
||||
String dateYear = date.substring(0,4);
|
||||
if(!yearList.contains(dateYear)){
|
||||
yearList.add(dateYear);
|
||||
}
|
||||
holidayDates.add(date);
|
||||
lastDateTme = DateUtils.addDays(lastDateTme,1);
|
||||
}
|
||||
//然后排除公休 排除法休
|
||||
for (String year : yearList){
|
||||
List<String> holidays = Collections.findDuplicatesList(ParamUtils.getHoliddayList(Integer.valueOf(year), 0), holidayDates);
|
||||
if(Collections.isNotEmpty(holidays)){
|
||||
holidayDates.removeAll(holidays);
|
||||
}
|
||||
}
|
||||
|
||||
//剩余时长> 3天, 继续检查请假
|
||||
if(holidayDates.size() > 3){
|
||||
//排除假期
|
||||
List<String> leaveDays = Collections.emptyList();
|
||||
for (String holidayDate : holidayDates){
|
||||
if(!leaveDays.contains(holidayDate)){
|
||||
RzLeaveDetail rzLeaveDetail = rzLeaveDetailMapper.selectRzLeaveDetailByUserIdAndDate(Long.valueOf(userId), DateUtils.parseDate(holidayDate));
|
||||
if(rzLeaveDetail != null &&rzLeaveDetail.getLeaveStartTime() != null && rzLeaveDetail.getLeaveEndTime() != null){
|
||||
Date leaveStartDate = rzLeaveDetail.getLeaveStartTime();
|
||||
while (leaveStartDate.compareTo(rzLeaveDetail.getLeaveEndTime()) <= 0){
|
||||
String date = sdfd.format(leaveStartDate);
|
||||
leaveDays.add(date);
|
||||
leaveStartDate = DateUtils.addDays(leaveStartDate,1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<String> holidays = Collections.findDuplicatesList(leaveDays, holidayDates);
|
||||
if(Collections.isNotEmpty(holidays)){
|
||||
holidayDates.removeAll(holidays);
|
||||
}
|
||||
//如果假期还是> 3天, 则准备推送
|
||||
if(holidayDates.size() > 3){
|
||||
SysStaff sysStaff = sysStaffMapper.selectById(userId);
|
||||
if(sysStaff != null) {
|
||||
SysDept sysDept = sysDeptMapper.selectById(sysStaff.getDeptId());
|
||||
String deptName = sysDept != null ? sysDept.getDeptName() : "未知";
|
||||
String userName = sysStaff.getName();
|
||||
// 查询人资办人员信息
|
||||
List<SysStaff> rzb = sysStaffMapper.queryysStaffByDeptId(Collections.asList(28l));
|
||||
if(Collections.isNotEmpty(rzb)){
|
||||
for (SysStaff rz : rzb){
|
||||
sendAttendanceDetail(userName, deptName, rz.getOpenid());
|
||||
}
|
||||
}
|
||||
//查询部门负责人
|
||||
SysStaff leaderSysStaff = sysStaffMapper.selectLeaderSysStaffByDeptId(sysStaff.getDeptId());
|
||||
if(leaderSysStaff != null){
|
||||
sendAttendanceDetail(userName, deptName, leaderSysStaff.getOpenid());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Async
|
||||
protected void sendAttendanceDetail(String userName, String deptName, String openId){
|
||||
try {
|
||||
if(StringUtils.isNotEmpty(openId)){
|
||||
sendClientService.sendAbnormalAttendance(deptName,userName, "长时间未打卡", new Date(), openId);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("推送公众号打卡异常失败, 原因为: {}", e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -67,6 +67,14 @@ public class TestController {
|
||||
@Resource
|
||||
private GZHAccessTokenService gzhAccessTokenService;
|
||||
|
||||
/**
|
||||
* 清洗加班
|
||||
*/
|
||||
@GetMapping("/testSend")
|
||||
public AjaxResult sendAttendanceDetail() throws ParseException {
|
||||
rzAttendanceDetailService.sendAttendanceDetail();
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 清洗加班
|
||||
|
||||
@ -58,6 +58,23 @@ public class ParamUtils {
|
||||
this.rzHolidayService = rzHolidayService;
|
||||
}
|
||||
|
||||
/***
|
||||
* 获取餐厅的开放时间
|
||||
* @return
|
||||
*/
|
||||
public static Double getWaterUnitPrice(){
|
||||
RzSysParam param= paramService.getRzSysParam("餐厅水单价", "water_unit_price","5.03","餐厅水单价");
|
||||
return Double.valueOf(param.getParamValue());
|
||||
}
|
||||
|
||||
/***
|
||||
* 获取餐厅的开放时间
|
||||
* @return
|
||||
*/
|
||||
public static Double getElectricityUnitPrice(){
|
||||
RzSysParam param= paramService.getRzSysParam("餐厅电单价", "electricity_unit_price","0.73","餐厅的开放就餐时间, 多个时间用,间隔");
|
||||
return Double.valueOf(param.getParamValue());
|
||||
}
|
||||
|
||||
/***
|
||||
* 获取餐厅的开放时间
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,70 @@
|
||||
package com.evo.personnelMatters.controller;
|
||||
|
||||
import com.evo.common.annotation.Log;
|
||||
import com.evo.common.core.controller.BaseController;
|
||||
import com.evo.common.core.domain.AjaxResult;
|
||||
import com.evo.common.core.page.TableDataInfo;
|
||||
import com.evo.common.enums.BusinessType;
|
||||
import com.evo.personnelMatters.domain.RzMealExpenses;
|
||||
import com.evo.personnelMatters.service.RzMealExpensesService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* RzMealExpensesController
|
||||
*
|
||||
* @author andy.shi
|
||||
* @ClassName:RzMealExpensesController
|
||||
* @date: 2025年11月26日 15:08
|
||||
* @remark: 开发人员联系方式 1042025947@qq.com/微信同步
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/meal/expenses")
|
||||
public class RzMealExpensesController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private RzMealExpensesService mealExpensesService;
|
||||
|
||||
/**
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('meal:expenses:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(RzMealExpenses mealExpenses) {
|
||||
startPage();
|
||||
List<RzMealExpenses> list = mealExpensesService.selectList(mealExpenses);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取员工管理详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:staff:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(mealExpensesService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('meal:expenses:edit')")
|
||||
@Log(title = "餐费管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/edit")
|
||||
public AjaxResult edit(@RequestBody RzMealExpenses mealExpenses)
|
||||
{
|
||||
return success(mealExpensesService.updateRzMealExpenses(mealExpenses));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('meal:expenses:export')")
|
||||
@Log(title = "餐费管理", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public AjaxResult export(RzMealExpenses mealExpenses){
|
||||
return mealExpensesService.export(mealExpenses);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,66 @@
|
||||
package com.evo.personnelMatters.controller;
|
||||
|
||||
import com.evo.common.annotation.Log;
|
||||
import com.evo.common.core.controller.BaseController;
|
||||
import com.evo.common.core.domain.AjaxResult;
|
||||
import com.evo.common.core.page.TableDataInfo;
|
||||
import com.evo.common.enums.BusinessType;
|
||||
import com.evo.personnelMatters.domain.RzLeaveDetail;
|
||||
import com.evo.personnelMatters.domain.RzMealExpenses;
|
||||
import com.evo.personnelMatters.domain.RzMealExpensesDetail;
|
||||
import com.evo.personnelMatters.service.RzMealExpensesDetailService;
|
||||
import com.evo.personnelMatters.service.RzMealExpensesService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* RzMealExpensesController
|
||||
*
|
||||
* @author andy.shi
|
||||
* @ClassName:RzMealExpensesController
|
||||
* @date: 2025年11月26日 15:08
|
||||
* @remark: 开发人员联系方式 1042025947@qq.com/微信同步
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/meal/expenses/detail")
|
||||
public class RzMealExpensesDetailController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private RzMealExpensesDetailService mealExpensesDetailService;
|
||||
|
||||
/**
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('meal:expensesDetail:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(RzMealExpensesDetail mealExpensesDetail) {
|
||||
startPage();
|
||||
List<RzMealExpensesDetail> list = mealExpensesDetailService.selectList(mealExpensesDetail);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增请假管理详情
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('meal:expensesDetail:add')")
|
||||
@Log(title = "请假管理详情", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody RzMealExpensesDetail mealExpensesDetail)
|
||||
{
|
||||
return success(mealExpensesDetailService.saveRzMealExpensesDetail(mealExpensesDetail));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除请假管理详情
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('meal:expensesDetail:remove')")
|
||||
@Log(title = "请假管理详情", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{id}")
|
||||
public AjaxResult remove(@PathVariable Long id)
|
||||
{
|
||||
return success(mealExpensesDetailService.removeRzMealExpensesDetail(id));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,63 @@
|
||||
package com.evo.personnelMatters.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.evo.common.annotation.Excel;
|
||||
import com.evo.common.core.domain.BaseEntity;
|
||||
import com.evo.common.utils.DateUtils;
|
||||
import com.evo.common.utils.ParamUtils;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 餐费信息 rz_leave
|
||||
*
|
||||
* @author evo
|
||||
* @date 2025-03-15
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class RzMealExpenses extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/** 年月 */
|
||||
@TableField("year_month_time")
|
||||
private String yearMonthTime;
|
||||
/** 水费 */
|
||||
private Double waterFee;
|
||||
/** 水费单价 */
|
||||
private Double waterUnitPrice;
|
||||
/** 水费用量 */
|
||||
private Double waterDosage;
|
||||
/** 电费 */
|
||||
private Double electricityFee;
|
||||
/** 电费单价 */
|
||||
private Double electricityUnitPrice;
|
||||
/** 电费用量 */
|
||||
private Double electricityDosage;
|
||||
/** 招待费 */
|
||||
private Double hospitalityFee;
|
||||
/** 加班福利费 */
|
||||
private Double overtimeBenefits;
|
||||
|
||||
|
||||
public RzMealExpenses() {
|
||||
}
|
||||
|
||||
public RzMealExpenses(String yearMonthTime, Double waterUnitPrice, Double electricityUnitPrice) {
|
||||
this.yearMonthTime = yearMonthTime;
|
||||
this.waterUnitPrice = waterUnitPrice;
|
||||
this.electricityUnitPrice = electricityUnitPrice;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
package com.evo.personnelMatters.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.evo.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 餐费详情信息 rz_leave
|
||||
*
|
||||
* @author evo
|
||||
* @date 2025-03-15
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class RzMealExpensesDetail extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
private Long expensesId;
|
||||
/** 类型. 1 招待 2 加班福利 3餐券 */
|
||||
private Integer type;
|
||||
/***
|
||||
* 餐券类型 早餐, 午餐 晚餐
|
||||
*/
|
||||
private String mealVoucherType;
|
||||
/***
|
||||
* 次数
|
||||
*/
|
||||
private Integer num;
|
||||
/** 单价 */
|
||||
private Double unitPrice;
|
||||
|
||||
private Double totalPrice;
|
||||
|
||||
private String companyName;
|
||||
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
package com.evo.personnelMatters.domain.vo;
|
||||
|
||||
import com.evo.common.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class MealExpensesExportVo {
|
||||
|
||||
@Excel(name = "项目")
|
||||
private String productName;
|
||||
@Excel(name = "刷脸次数", showAllSheet = false, showViewHome = false)
|
||||
private Integer faceScanNum;
|
||||
@Excel(name = "餐券次数", showAllSheet = false, showViewHome = false)
|
||||
private String mealVoucherNum;
|
||||
@Excel(name = "单价", showAllSheet = false,showViewHome = false)
|
||||
private String unitPrice;
|
||||
@Excel(name = "金额")
|
||||
private BigDecimal totalAmount;
|
||||
@Excel(name = "备注", showAllSheet = false, showViewHome = false)
|
||||
private String remarks;
|
||||
|
||||
private String companyName;
|
||||
//招待费
|
||||
private String hospitalityFee;
|
||||
//福利费
|
||||
private String welfareFee;
|
||||
|
||||
|
||||
public MealExpensesExportVo() {
|
||||
}
|
||||
|
||||
public MealExpensesExportVo(String productName, BigDecimal totalAmount) {
|
||||
this.productName = productName;
|
||||
this.totalAmount = totalAmount;
|
||||
}
|
||||
|
||||
public MealExpensesExportVo(Integer faceScanNum, String mealVoucherNum, BigDecimal totalAmount) {
|
||||
this.faceScanNum = faceScanNum;
|
||||
this.mealVoucherNum = mealVoucherNum;
|
||||
this.totalAmount = totalAmount;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
package com.evo.personnelMatters.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.evo.personnelMatters.domain.RzMealExpenses;
|
||||
import com.evo.personnelMatters.domain.RzMealExpensesDetail;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 请假管理Mapper接口
|
||||
*
|
||||
* @author chenyj
|
||||
* @date 2024-08-03
|
||||
*/
|
||||
public interface RzMealExpensesDetailMapper extends BaseMapper<RzMealExpensesDetail>
|
||||
{
|
||||
|
||||
List<RzMealExpensesDetail> selectAllList(RzMealExpensesDetail mealExpensesDetail);
|
||||
|
||||
List<Map<String, Object>> selectDetailMapByTime(@Param("month")String month);
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package com.evo.personnelMatters.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.evo.personnelMatters.domain.RzLeave;
|
||||
import com.evo.personnelMatters.domain.RzMealExpenses;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 请假管理Mapper接口
|
||||
*
|
||||
* @author chenyj
|
||||
* @date 2024-08-03
|
||||
*/
|
||||
public interface RzMealExpensesMapper extends BaseMapper<RzMealExpenses>
|
||||
{
|
||||
|
||||
List<RzMealExpenses> selectAllList(RzMealExpenses mealExpenses);
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
package com.evo.personnelMatters.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.evo.personnelMatters.domain.RzMealExpenses;
|
||||
import com.evo.personnelMatters.domain.RzMealExpensesDetail;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 请假管理Service接口
|
||||
*
|
||||
* @author chenyj
|
||||
* @date 2024-08-03
|
||||
*/
|
||||
public interface RzMealExpensesDetailService extends IService<RzMealExpensesDetail>
|
||||
{
|
||||
/**
|
||||
*/
|
||||
public List<RzMealExpensesDetail> selectList(RzMealExpensesDetail mealExpensesDetail);
|
||||
|
||||
public Boolean saveRzMealExpensesDetail(RzMealExpensesDetail mealExpensesDetail);
|
||||
|
||||
public Boolean removeRzMealExpensesDetail(Long id);
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
package com.evo.personnelMatters.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.evo.common.core.domain.AjaxResult;
|
||||
import com.evo.finance.domain.RzSalaryDetail;
|
||||
import com.evo.personnelMatters.domain.RzLeave;
|
||||
import com.evo.personnelMatters.domain.RzLeaveDetail;
|
||||
import com.evo.personnelMatters.domain.RzMealExpenses;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 请假管理Service接口
|
||||
*
|
||||
* @author chenyj
|
||||
* @date 2024-08-03
|
||||
*/
|
||||
public interface RzMealExpensesService extends IService<RzMealExpenses>
|
||||
{
|
||||
/**
|
||||
*/
|
||||
public List<RzMealExpenses> selectList(RzMealExpenses rzMealExpenses);
|
||||
|
||||
Boolean updateRzMealExpenses(RzMealExpenses rzMealExpenses);
|
||||
|
||||
AjaxResult export(RzMealExpenses rzMealExpenses);
|
||||
}
|
||||
@ -0,0 +1,76 @@
|
||||
package com.evo.personnelMatters.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.evo.common.utils.DataUtils;
|
||||
import com.evo.personnelMatters.domain.RzMealExpenses;
|
||||
import com.evo.personnelMatters.domain.RzMealExpensesDetail;
|
||||
import com.evo.personnelMatters.mapper.RzMealExpensesDetailMapper;
|
||||
import com.evo.personnelMatters.mapper.RzMealExpensesMapper;
|
||||
import com.evo.personnelMatters.service.RzMealExpensesDetailService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* RzMealExpensesServiceImpl
|
||||
*
|
||||
* @author andy.shi
|
||||
* @ClassName:RzMealExpensesServiceImpl
|
||||
* @date: 2025年11月26日 15:15
|
||||
* @remark: 开发人员联系方式 1042025947@qq.com/微信同步
|
||||
*/
|
||||
@Service
|
||||
public class RzMealExpensesDetailServiceImpl extends ServiceImpl<RzMealExpensesDetailMapper, RzMealExpensesDetail> implements RzMealExpensesDetailService {
|
||||
|
||||
|
||||
@Resource
|
||||
RzMealExpensesMapper mealExpensesMapper;
|
||||
|
||||
@Override
|
||||
public List<RzMealExpensesDetail> selectList(RzMealExpensesDetail mealExpensesDetail) {
|
||||
return getBaseMapper().selectAllList(mealExpensesDetail);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean saveRzMealExpensesDetail(RzMealExpensesDetail mealExpensesDetail) {
|
||||
Boolean result = false;
|
||||
if(result = save(mealExpensesDetail)){
|
||||
RzMealExpenses rzMealExpenses = mealExpensesMapper.selectById(mealExpensesDetail.getExpensesId());
|
||||
if(rzMealExpenses != null){
|
||||
if(mealExpensesDetail.getType() == 1){
|
||||
rzMealExpenses.setHospitalityFee(DataUtils.findDefaultValue(rzMealExpenses.getHospitalityFee(), 0d)+DataUtils.findDefaultValue(mealExpensesDetail.getTotalPrice(),0d));
|
||||
}else if(mealExpensesDetail.getType() == 2){
|
||||
rzMealExpenses.setOvertimeBenefits(DataUtils.findDefaultValue(rzMealExpenses.getOvertimeBenefits(), 0d)+DataUtils.findDefaultValue(mealExpensesDetail.getTotalPrice(),0d));
|
||||
}else if(mealExpensesDetail.getType() == 3){
|
||||
//暂时不做处理
|
||||
}
|
||||
result = mealExpensesMapper.updateById(rzMealExpenses) > 0;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean removeRzMealExpensesDetail(Long id) {
|
||||
RzMealExpensesDetail mealExpensesDetail = getById(id);
|
||||
if(mealExpensesDetail != null){
|
||||
RzMealExpenses rzMealExpenses = mealExpensesMapper.selectById(mealExpensesDetail.getExpensesId());
|
||||
if(rzMealExpenses != null){
|
||||
if(mealExpensesDetail.getType() == 1){
|
||||
rzMealExpenses.setHospitalityFee(DataUtils.findDefaultValue(rzMealExpenses.getHospitalityFee(), 0d)-DataUtils.findDefaultValue(mealExpensesDetail.getTotalPrice(),0d));
|
||||
if(rzMealExpenses.getHospitalityFee().compareTo(0d) < 0){
|
||||
rzMealExpenses.setHospitalityFee(0d);
|
||||
}
|
||||
}else if(mealExpensesDetail.getType() == 2){
|
||||
rzMealExpenses.setOvertimeBenefits(DataUtils.findDefaultValue(rzMealExpenses.getOvertimeBenefits(), 0d)-DataUtils.findDefaultValue(mealExpensesDetail.getTotalPrice(),0d));
|
||||
}else if(mealExpensesDetail.getType() == 3){
|
||||
//暂时不做处理
|
||||
}
|
||||
mealExpensesMapper.updateById(rzMealExpenses);
|
||||
}
|
||||
}
|
||||
return removeById(mealExpensesDetail);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,151 @@
|
||||
package com.evo.personnelMatters.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.evo.common.core.domain.AjaxResult;
|
||||
import com.evo.common.utils.Collections;
|
||||
import com.evo.common.utils.DataUtils;
|
||||
import com.evo.common.utils.ParamUtils;
|
||||
import com.evo.common.utils.SecurityUtils;
|
||||
import com.evo.common.utils.poi.handler.ExcelNewUtils;
|
||||
import com.evo.personnelMatters.domain.RzMealExpenses;
|
||||
import com.evo.personnelMatters.domain.vo.MealExpensesExportVo;
|
||||
import com.evo.personnelMatters.mapper.RzMealExpensesDetailMapper;
|
||||
import com.evo.personnelMatters.mapper.RzMealExpensesMapper;
|
||||
import com.evo.personnelMatters.service.RzMealExpensesService;
|
||||
import com.evo.restaurant.mapper.RzRestaurantDetailMapper;
|
||||
import com.evo.system.mapper.SysDictDataMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* RzMealExpensesServiceImpl
|
||||
*
|
||||
* @author andy.shi
|
||||
* @ClassName:RzMealExpensesServiceImpl
|
||||
* @date: 2025年11月26日 15:15
|
||||
* @remark: 开发人员联系方式 1042025947@qq.com/微信同步
|
||||
*/
|
||||
@Service
|
||||
public class RzMealExpensesServiceImpl extends ServiceImpl<RzMealExpensesMapper, RzMealExpenses> implements RzMealExpensesService {
|
||||
|
||||
@Resource
|
||||
private SysDictDataMapper sysDictDataMapper;
|
||||
@Resource
|
||||
private RzRestaurantDetailMapper rzRestaurantDetailMapper;
|
||||
@Resource
|
||||
private RzMealExpensesDetailMapper mealExpensesDetailMapper;
|
||||
|
||||
@Override
|
||||
public List<RzMealExpenses> selectList(RzMealExpenses mealExpenses) {
|
||||
return getBaseMapper().selectAllList(mealExpenses);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updateRzMealExpenses(RzMealExpenses rzMealExpenses) {
|
||||
rzMealExpenses.setWaterFee(new BigDecimal(DataUtils.findDefaultValue(rzMealExpenses.getWaterDosage(), 0d)).multiply(new BigDecimal(DataUtils.findDefaultValue(rzMealExpenses.getWaterUnitPrice(), ParamUtils.getWaterUnitPrice()))).setScale(2, BigDecimal.ROUND_HALF_UP ).doubleValue());
|
||||
rzMealExpenses.setElectricityFee(new BigDecimal(DataUtils.findDefaultValue(rzMealExpenses.getElectricityDosage(), 0d)).multiply(new BigDecimal(DataUtils.findDefaultValue(rzMealExpenses.getElectricityUnitPrice(), ParamUtils.getElectricityUnitPrice()))).setScale(2, BigDecimal.ROUND_HALF_UP ).doubleValue());
|
||||
return updateById(rzMealExpenses);
|
||||
}
|
||||
|
||||
public static MealExpensesExportVo sumMealExpensesExportVo(List<MealExpensesExportVo> list){
|
||||
if(Collections.isEmpty(list)){
|
||||
return new MealExpensesExportVo(BigDecimal.ZERO.intValue(), BigDecimal.ZERO.toString(), BigDecimal.ZERO);
|
||||
}
|
||||
MealExpensesExportVo result = list.stream().reduce((x, y) -> new MealExpensesExportVo(
|
||||
new BigDecimal(x.getFaceScanNum()).add(new BigDecimal(y.getFaceScanNum())).intValue(),
|
||||
new BigDecimal(x.getMealVoucherNum()).add(new BigDecimal(y.getMealVoucherNum())).toString(),(x.getTotalAmount().add(y.getTotalAmount())))).orElse(new MealExpensesExportVo(BigDecimal.ZERO.intValue(), BigDecimal.ZERO.toString(), BigDecimal.ZERO));
|
||||
//添加此处的原因是, 如果部门中, 有且只有1人的情况下, stream().reduce() 不会创建新的对象, 只是把唯一的对象返回了,, 会对后续的数据展示产生影响, 所以重新创new新对象
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult export(RzMealExpenses rzMealExpenses) {
|
||||
ExcelNewUtils<MealExpensesExportVo> util = new ExcelNewUtils<MealExpensesExportVo>(MealExpensesExportVo.class);
|
||||
|
||||
List<MealExpensesExportVo> excelResult = buildExportData(rzMealExpenses);
|
||||
|
||||
RzMealExpenses mealExpenses = getOne(new LambdaQueryWrapper<RzMealExpenses>().eq(RzMealExpenses::getYearMonthTime, rzMealExpenses.getYearMonthTime()),false);
|
||||
|
||||
|
||||
Map<String,List<MealExpensesExportVo>> companyDataList = excelResult.stream().collect(Collectors.groupingBy(MealExpensesExportVo::getCompanyName));
|
||||
//公司名字
|
||||
List<String> sheetCompanyNames = Collections.asList(companyDataList.keySet());
|
||||
sheetCompanyNames.set(0, "汇总");
|
||||
|
||||
List<MealExpensesExportVo> indexDataList = Collections.emptyList();
|
||||
|
||||
List<List<MealExpensesExportVo>> companyLists = new ArrayList<>();
|
||||
for (String sheetCompanyName : sheetCompanyNames){
|
||||
List<MealExpensesExportVo> dataList = companyDataList.get(sheetCompanyName);
|
||||
if(Collections.isEmpty(dataList)){
|
||||
companyLists.add(Collections.emptyList());
|
||||
continue;
|
||||
}
|
||||
MealExpensesExportVo total = sumMealExpensesExportVo(dataList);
|
||||
total.setProductName("小计");
|
||||
dataList.add(total);
|
||||
if(sheetCompanyName.equals("河北伊特")){
|
||||
BigDecimal total1 = total.getTotalAmount();
|
||||
dataList.add(new MealExpensesExportVo("招待费", new BigDecimal(mealExpenses.getHospitalityFee()).setScale(2, BigDecimal.ROUND_HALF_UP)));
|
||||
total1 = total1.add(new BigDecimal(mealExpenses.getHospitalityFee())).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
|
||||
dataList.add(new MealExpensesExportVo("福利费", new BigDecimal(mealExpenses.getOvertimeBenefits()).setScale(2, BigDecimal.ROUND_HALF_UP)));
|
||||
total1.add(new BigDecimal(mealExpenses.getOvertimeBenefits())).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
|
||||
dataList.add(new MealExpensesExportVo("水费", new BigDecimal(mealExpenses.getWaterFee()).setScale(2, BigDecimal.ROUND_HALF_UP)));
|
||||
total1 = total1.subtract(new BigDecimal(mealExpenses.getWaterFee())).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
|
||||
dataList.add(new MealExpensesExportVo("电费", new BigDecimal(mealExpenses.getElectricityFee()).setScale(2, BigDecimal.ROUND_HALF_UP)));
|
||||
total1 = total1.subtract(new BigDecimal(mealExpenses.getElectricityFee()).setScale(2, BigDecimal.ROUND_HALF_UP));
|
||||
|
||||
dataList.add(new MealExpensesExportVo("合计", total1));
|
||||
|
||||
indexDataList.add(new MealExpensesExportVo(sheetCompanyName+rzMealExpenses.getYearMonthTime()+"月餐费结算清单", new BigDecimal(mealExpenses.getElectricityFee()).setScale(2, BigDecimal.ROUND_HALF_UP)));
|
||||
}else{
|
||||
indexDataList.add(new MealExpensesExportVo(sheetCompanyName+rzMealExpenses.getYearMonthTime()+"月餐费结算清单", total.getTotalAmount().setScale(2, BigDecimal.ROUND_HALF_UP)));
|
||||
}
|
||||
companyLists.add(dataList);
|
||||
}
|
||||
companyLists.set(0, indexDataList);
|
||||
String name = "";
|
||||
try {
|
||||
name = SecurityUtils.getUsername();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
return util.exportExcel(rzMealExpenses.getYearMonthTime()+"月餐费结算清单",companyLists, sheetCompanyNames, rzMealExpenses.getYearMonthTime()+"月餐费结算清单", "制表: "+name+" "+"审核: "+"经理签字: "+"总经理签字:");
|
||||
|
||||
}
|
||||
private List<MealExpensesExportVo> buildExportData(RzMealExpenses mealExpenses) {
|
||||
//查询餐饮详情
|
||||
List<Map<String, Object>> detailListMap = rzRestaurantDetailMapper.selectDetailAllListMap(mealExpenses.getYearMonthTime());
|
||||
//查询餐券详情
|
||||
List<Map<String, Object>> detailList = mealExpensesDetailMapper.selectDetailMapByTime(mealExpenses.getYearMonthTime());
|
||||
//数据转换
|
||||
Map<String,Map<String, Object>> detailMap = detailList.stream().collect(Collectors.toMap(d-> String.valueOf(d.get("companyName")), d->d, (k1,k2)->k1));
|
||||
List<MealExpensesExportVo> voResult = Collections.emptyList();
|
||||
detailListMap.forEach(detail -> {
|
||||
Map<String, Object> dm = detailMap.get(String.valueOf(detail.get("companyName")));
|
||||
MealExpensesExportVo exportVo = new MealExpensesExportVo();
|
||||
exportVo.setProductName(String.valueOf(detail.get("productName")));
|
||||
exportVo.setFaceScanNum(Integer.valueOf(String.valueOf(detail.get("faceScanNum"))));
|
||||
exportVo.setUnitPrice(String.valueOf(detail.get("unitPrice")));
|
||||
exportVo.setCompanyName(String.valueOf(detail.get("companyName")));
|
||||
if(Collections.isNotEmpty(dm)){
|
||||
exportVo.setMealVoucherNum(String.valueOf(DataUtils.findDefaultValue(dm.get(String.valueOf(detail.get("productName"))), 0)));
|
||||
}else {
|
||||
exportVo.setMealVoucherNum("0");
|
||||
}
|
||||
exportVo.setTotalAmount((new BigDecimal(exportVo.getFaceScanNum()).add(new BigDecimal(DataUtils.findDefaultValue(exportVo.getMealVoucherNum(), "0")))).multiply(new BigDecimal(exportVo.getUnitPrice())).setScale(2, BigDecimal.ROUND_HALF_UP));
|
||||
voResult.add(exportVo);
|
||||
});
|
||||
return voResult;
|
||||
}
|
||||
}
|
||||
@ -1,18 +1,26 @@
|
||||
package com.evo.restaurant.controller;
|
||||
|
||||
import com.evo.common.annotation.Log;
|
||||
import com.evo.common.constant.Constants;
|
||||
import com.evo.common.core.controller.BaseController;
|
||||
import com.evo.common.core.domain.AjaxResult;
|
||||
import com.evo.common.core.domain.entity.SysUser;
|
||||
import com.evo.common.core.page.TableDataInfo;
|
||||
import com.evo.common.enums.BusinessType;
|
||||
import com.evo.common.utils.DateUtils;
|
||||
import com.evo.common.utils.SecurityUtils;
|
||||
import com.evo.common.utils.StringUtils;
|
||||
import com.evo.common.utils.poi.ExcelUtil;
|
||||
import com.evo.restaurant.domain.RzRestaurantDetail;
|
||||
import com.evo.restaurant.service.IRzRestaurantDetailService;
|
||||
import com.evo.system.domain.SysStaff;
|
||||
import com.evo.system.service.ISysStaffService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -27,7 +35,8 @@ public class RzRestaurantDetailController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IRzRestaurantDetailService rzRestaurantDetailService;
|
||||
|
||||
@Autowired
|
||||
private ISysStaffService sysStaffService;
|
||||
/**
|
||||
* 查询餐饮详情列表
|
||||
*/
|
||||
@ -85,5 +94,31 @@ public class RzRestaurantDetailController extends BaseController
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('api:v2:add')")
|
||||
@Log(title = "餐饮详情", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/save")
|
||||
public AjaxResult add(@Validated @RequestBody RzRestaurantDetail rzRestaurantDetail)
|
||||
{
|
||||
rzRestaurantDetail.setName(sysStaffService.getById(rzRestaurantDetail.getStaffId()).getName());
|
||||
rzRestaurantDetail.setTime(getTime(rzRestaurantDetail));
|
||||
rzRestaurantDetail.setDelFlag(Constants.DELETE_FLAG_0);
|
||||
return toAjax(rzRestaurantDetailService.saveRzRestaurantDetail(rzRestaurantDetail));
|
||||
}
|
||||
|
||||
public Date getTime(RzRestaurantDetail rzRestaurantDetail){
|
||||
switch (rzRestaurantDetail.getSign()){
|
||||
case "早餐":
|
||||
return DateUtils.setHours(rzRestaurantDetail.getDate(), 8);
|
||||
case "午餐":
|
||||
return DateUtils.setHours(rzRestaurantDetail.getDate(), 12);
|
||||
case "晚餐":
|
||||
return DateUtils.setHours(rzRestaurantDetail.getDate(), 18);
|
||||
default:
|
||||
return rzRestaurantDetail.getDate();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,8 +1,11 @@
|
||||
package com.evo.restaurant.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.evo.common.annotation.Excel;
|
||||
import com.evo.common.core.domain.BaseEntity;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
@ -14,11 +17,13 @@ import java.util.Date;
|
||||
* @author chenyj
|
||||
* @date 2024-09-18
|
||||
*/
|
||||
@Data
|
||||
public class RzRestaurantDetail extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
//员工ID
|
||||
private Long staffId;
|
||||
@ -49,84 +54,6 @@ public class RzRestaurantDetail extends BaseEntity
|
||||
/** 删除标记 */
|
||||
private String delFlag;
|
||||
|
||||
public Date getMonth() {
|
||||
return month;
|
||||
}
|
||||
|
||||
public void setMonth(Date month) {
|
||||
this.month = month;
|
||||
}
|
||||
|
||||
public Long getStaffId() {
|
||||
return staffId;
|
||||
}
|
||||
|
||||
public void setStaffId(Long staffId) {
|
||||
this.staffId = staffId;
|
||||
}
|
||||
|
||||
public int getNumber() {
|
||||
return number;
|
||||
}
|
||||
|
||||
public void setNumber(int number) {
|
||||
this.number = number;
|
||||
}
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
public void setDate(Date date)
|
||||
{
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public Date getDate()
|
||||
{
|
||||
return date;
|
||||
}
|
||||
public void setTime(Date time)
|
||||
{
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public Date getTime()
|
||||
{
|
||||
return time;
|
||||
}
|
||||
public void setSign(String sign)
|
||||
{
|
||||
this.sign = sign;
|
||||
}
|
||||
|
||||
public String getSign()
|
||||
{
|
||||
return sign;
|
||||
}
|
||||
public void setDelFlag(String delFlag)
|
||||
{
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getDelFlag()
|
||||
{
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.evo.restaurant.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.evo.restaurant.domain.RzRestaurantDetail;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@ -13,7 +14,7 @@ import java.util.Map;
|
||||
* @author chenyj
|
||||
* @date 2024-09-18
|
||||
*/
|
||||
public interface RzRestaurantDetailMapper
|
||||
public interface RzRestaurantDetailMapper extends BaseMapper<RzRestaurantDetail>
|
||||
{
|
||||
/**
|
||||
* 查询餐饮详情
|
||||
@ -47,4 +48,6 @@ public interface RzRestaurantDetailMapper
|
||||
|
||||
|
||||
public List<Map<String, Object>> selectRzRestaurantDetailListMap(@Param("month") Date month);
|
||||
|
||||
public List<Map<String, Object>> selectDetailAllListMap(@Param("month") String month);
|
||||
}
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
package com.evo.restaurant.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.evo.common.core.domain.AjaxResult;
|
||||
import com.evo.restaurant.domain.RzRestaurantDetail;
|
||||
import com.evo.system.domain.SysStaff;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -11,7 +13,7 @@ import java.util.List;
|
||||
* @author chenyj
|
||||
* @date 2024-09-18
|
||||
*/
|
||||
public interface IRzRestaurantDetailService
|
||||
public interface IRzRestaurantDetailService extends IService<RzRestaurantDetail>
|
||||
{
|
||||
|
||||
/**
|
||||
@ -22,6 +24,7 @@ public interface IRzRestaurantDetailService
|
||||
*/
|
||||
public List<RzRestaurantDetail> selectRzRestaurantDetailList(RzRestaurantDetail rzRestaurantDetail);
|
||||
|
||||
public Boolean saveRzRestaurantDetail(RzRestaurantDetail rzRestaurantDetail);
|
||||
/**
|
||||
* 新增餐饮详情
|
||||
*
|
||||
@ -30,6 +33,7 @@ public interface IRzRestaurantDetailService
|
||||
*/
|
||||
public String insertRzRestaurantDetail(String json);
|
||||
|
||||
|
||||
/**
|
||||
* 当前时间的就餐人数
|
||||
* @return
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.evo.restaurant.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.evo.common.constant.Constants;
|
||||
import com.evo.common.utils.ParamUtils;
|
||||
import com.evo.common.utils.StringUtils;
|
||||
@ -30,7 +31,7 @@ import java.util.Map;
|
||||
* @date 2024-09-18
|
||||
*/
|
||||
@Service
|
||||
public class RzRestaurantDetailServiceImpl implements IRzRestaurantDetailService
|
||||
public class RzRestaurantDetailServiceImpl extends ServiceImpl<RzRestaurantDetailMapper, RzRestaurantDetail> implements IRzRestaurantDetailService
|
||||
{
|
||||
@Resource
|
||||
private RzRestaurantDetailMapper rzRestaurantDetailMapper;
|
||||
@ -52,6 +53,27 @@ public class RzRestaurantDetailServiceImpl implements IRzRestaurantDetailService
|
||||
{
|
||||
return rzRestaurantDetailMapper.selectRzRestaurantDetailList(rzRestaurantDetail);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean saveRzRestaurantDetail(RzRestaurantDetail rzRestaurantDetail) {
|
||||
Boolean result = false;
|
||||
if(result = save(rzRestaurantDetail)) {
|
||||
RzRestaurantStatistics restaurantStatistics = rzRestaurantStatisticsMapper.selectRzRestaurantStatisticsByUserIdAndDate(Long.valueOf(rzRestaurantDetail.getStaffId()), rzRestaurantDetail.getDate());
|
||||
if (restaurantStatistics != null) {
|
||||
switch (rzRestaurantDetail.getSign()) {
|
||||
case "早餐":
|
||||
restaurantStatistics.setBreakfastNumber(restaurantStatistics.getBreakfastNumber() + 1);
|
||||
case "午餐":
|
||||
restaurantStatistics.setLunchNumber(restaurantStatistics.getLunchNumber() + 1);
|
||||
case "晚餐":
|
||||
restaurantStatistics.setSupperNumber(restaurantStatistics.getSupperNumber() + 1);
|
||||
}
|
||||
result = rzRestaurantStatisticsMapper.updateRzRestaurantStatistics(restaurantStatistics) > 0;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增餐饮详情
|
||||
*
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.evo.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.evo.common.utils.Collections;
|
||||
import com.evo.system.domain.SysStaff;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@ -80,5 +81,11 @@ s * @return
|
||||
* @return
|
||||
*/
|
||||
public List<SysStaff> queryysStaffByDeptId(List<Long> list);
|
||||
/***
|
||||
* 根据部门查询部门领导人
|
||||
* @param deptId
|
||||
* @return
|
||||
*/
|
||||
SysStaff selectLeaderSysStaffByDeptId(Long deptId);
|
||||
|
||||
}
|
||||
|
||||
@ -3,7 +3,11 @@ 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.attendance.service.RzAttendanceDetailService;
|
||||
import com.evo.common.utils.DateUtils;
|
||||
import com.evo.common.utils.ParamUtils;
|
||||
import com.evo.personnelMatters.domain.RzMealExpenses;
|
||||
import com.evo.personnelMatters.service.RzMealExpensesService;
|
||||
import com.evo.restaurant.domain.RzRestaurantImages;
|
||||
import com.evo.restaurant.domain.RzRestaurantStatistics;
|
||||
import com.evo.restaurant.service.IRzRestaurantImagesService;
|
||||
@ -14,6 +18,7 @@ import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.text.ParseException;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@ -32,12 +37,18 @@ public class TaskController {
|
||||
private IRzRestaurantImagesService rzRestaurantImagesService;
|
||||
@Resource
|
||||
private IRzAttendanceService rzAttendanceService;
|
||||
@Resource
|
||||
private RzAttendanceDetailService rzAttendanceDetailService;
|
||||
@Resource
|
||||
private RzMealExpensesService rzMealExpensesService;
|
||||
/**
|
||||
* 每月1号 0:20 自动生成考勤数据
|
||||
*/
|
||||
@Scheduled(cron = "0 20 0 1 * ?")
|
||||
public void autoCreateAttendanceData(){
|
||||
sysStaffService.autoCreateAttendanceData();
|
||||
|
||||
rzMealExpensesService.save(new RzMealExpenses(DateUtils.parseDateToStr("yyyy-MM", new Date()), ParamUtils.getWaterUnitPrice(), ParamUtils.getElectricityUnitPrice()));
|
||||
};
|
||||
/**
|
||||
* 每月1号 1:00 自动生成餐饮统计信息
|
||||
@ -101,6 +112,11 @@ public class TaskController {
|
||||
rzAttendanceService.sendAbnormalAttendance();
|
||||
}
|
||||
|
||||
@Scheduled(cron = "0 0 10 * * ?")
|
||||
public void autoAttendanceDetail() throws ParseException {
|
||||
rzAttendanceDetailService.sendAttendanceDetail();
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 每月10号2点自动计算工龄
|
||||
// */
|
||||
|
||||
@ -109,7 +109,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
order by date_time desc limit 1
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getThreeDayNotCheck" resultType="java.util.Map">
|
||||
select DATE_FORMAT(max(ad.date_time),'%Y-%m-%d') as lastDate, ad.staff_id as userId, DATEDIFF(DATE_FORMAT(now(),'%Y-%m-%d'), DATE_FORMAT(max(ad.date_time),'%Y-%m-%d')) as diffDays
|
||||
from rz_attendance_detail ad
|
||||
left join sys_staff s on s.user_id = ad.staff_id
|
||||
where s.`status` != '-1' AND ad.button_type like '%上班%' GROUP BY ad.staff_id HAVING DATEDIFF(DATE_FORMAT(now(),'%Y-%m-%d'), DATE_FORMAT(max(ad.date_time),'%Y-%m-%d')) > 3
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.evo.personnelMatters.mapper.RzMealExpensesDetailMapper">
|
||||
|
||||
<sql id="selectRzLeaveVo">
|
||||
select id, expenses_id, type, meal_voucher_type, num, total_price, unit_price, company_name, create_by, create_time, update_by, update_time from rz_meal_expenses_detail d
|
||||
</sql>
|
||||
|
||||
<select id="selectAllList" parameterType="com.evo.personnelMatters.domain.RzMealExpensesDetail" resultType="com.evo.personnelMatters.domain.RzMealExpensesDetail">
|
||||
<include refid="selectRzLeaveVo"/>
|
||||
<where>
|
||||
1=1
|
||||
<if test="expensesId != null"> and expenses_Id = #{expensesId}</if>
|
||||
${params.dataScope}
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectDetailMapByTime" resultType="java.util.Map">
|
||||
select
|
||||
SUM(IF(med.type =3 and med.meal_voucher_type ='早餐', med.num, 0)) AS zc,
|
||||
SUM(IF(med.type =3 and med.meal_voucher_type ='午餐', med.num, 0)) AS wc,
|
||||
SUM(IF(med.type =3 and med.meal_voucher_type ='晚餐', med.num, 0)) AS wcc,
|
||||
if(dd.dict_label is null or dd.dict_label='外包',"河北伊特",dd.dict_label)as companyName
|
||||
from rz_meal_expenses_detail med
|
||||
left join rz_meal_expenses me on me.id = med.expenses_id
|
||||
left join sys_dict_data dd on dd.dict_value = med.company_name COLLATE utf8mb4_croatian_ci and dd.dict_type = 'sys_company'
|
||||
where me.year_month_time = #{month} group by companyName
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.evo.personnelMatters.mapper.RzMealExpensesMapper">
|
||||
|
||||
|
||||
|
||||
<sql id="selectRzLeaveVo">
|
||||
select id, year_month_time, water_unit_price, water_fee, water_dosage, electricity_unit_price, electricity_fee, hospitality_fee, electricity_dosage, overtime_benefits, create_by, create_time, update_by, update_time from rz_meal_expenses d
|
||||
</sql>
|
||||
|
||||
<select id="selectAllList" parameterType="com.evo.personnelMatters.domain.RzMealExpenses" resultType="com.evo.personnelMatters.domain.RzMealExpenses">
|
||||
<include refid="selectRzLeaveVo"/>
|
||||
<where>
|
||||
1=1
|
||||
<if test="yearMonthTime != null and yearMonthTime != ''"> and year_month_time = #{yearMonthTime}</if>
|
||||
${params.dataScope}
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
@ -88,6 +88,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
and sign = #{sign}
|
||||
</select>
|
||||
|
||||
<select id="selectDetailAllListMap" resultType="java.util.Map">
|
||||
SELECT
|
||||
count(rd.id) as faceScanNum,
|
||||
rd.sign as productName,
|
||||
if(dd.dict_label is null or dd.dict_label='外包',"河北伊特",dd.dict_label)as companyName,
|
||||
ddr.dict_value as unitPrice
|
||||
from rz_restaurant_detail rd
|
||||
left join sys_staff s on s.user_id = rd.staff_id
|
||||
left join sys_dict_data dd on dd.dict_value = s.company_name and dd.dict_type = 'sys_company'
|
||||
left join sys_dict_data ddr on ddr.dict_label = CONCAT(rd.sign,'消费') and ddr.dict_type = 'sys_restaurant'
|
||||
where DATE_FORMAT(rd.date,'%Y-%m') = #{month} group by rd.sign,companyName,unitPrice
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
@ -272,4 +272,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
#{deptId}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectLeaderSysStaffByDeptId" resultMap="SysStaffResult">
|
||||
<include refid="selectSysStaffVo"/>
|
||||
where del_flag = '0' and status != '-1' and dept_id = #{deptId} limit 1
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user