feat(personnelMatters): 添加按日期查询请假记录功能并优化相关模块

- 在 IRzLeaveService 接口中添加 selectRzLeaveListByDate 方法
- 在 RzLeaveMapper.xml 中添加 holiday_type 字段的映射
- 修改 RzLeave 类,使用 Lombok 的 EqualsAndHashCode 注解
- 更新 RzLeaveController 中的 export 方法,使用新的按日期查询功能- 实现 RzLeaveServiceImpl 中的 selectRzLeaveListByDate 方法
- 优化 RzRestaurantStatisticsServiceImpl 中的公司名称获取逻辑
- 更新 SysStaff 类,调整字段顺序并添加公司名称字段
This commit is contained in:
tzy 2025-06-05 09:02:10 +08:00
parent c4a661c281
commit 5769b67686
12 changed files with 87 additions and 49 deletions

View File

@ -14,6 +14,8 @@ import com.evo.personnelMatters.service.IRzLeaveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.stream.Collectors;
@ -28,7 +30,7 @@ import java.util.stream.Collectors;
@RequestMapping("/personnelMatters/leave")
public class RzLeaveController extends BaseController
{
@Autowired
@Resource
private IRzLeaveService rzLeaveService;
/**
@ -57,7 +59,7 @@ public class RzLeaveController extends BaseController
@PostMapping("/export")
public void export(HttpServletResponse response, RzLeave rzLeave)
{
List<RzLeave> list = rzLeaveService.selectRzLeaveList(rzLeave);
List<RzLeave> list = rzLeaveService.selectRzLeaveListByDate(rzLeave);
ExcelUtil<RzLeave> util = new ExcelUtil<RzLeave>(RzLeave.class);
util.exportExcel(response, list, "请假数据");
}

View File

@ -4,6 +4,7 @@ import java.math.BigDecimal;
import java.util.Date;
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 com.evo.common.annotation.Excel;
@ -15,6 +16,7 @@ import com.evo.common.core.domain.BaseEntity;
* @author evo
* @date 2025-03-15
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class RzLeave extends BaseEntity
{
@ -37,44 +39,44 @@ public class RzLeave extends BaseEntity
private String name;
/** 请假月份(到月) */
// @Excel(name = "请假月份", readConverterExp = "到=月", dateFormat = "yyyy-MM")
// @JsonFormat(pattern = "yyyy-MM")
// private Date leaveDate;
@Excel(name = "请假月份", dateFormat = "yyyy-MM")
@JsonFormat(pattern = "yyyy-MM")
private Date leaveDate;
/** 病假时长(小时) */
@Excel(name = "病假时长", readConverterExp = "小=时")
@Excel(name = "病假时长")
private Integer sickHours;
/** 事假时长(小时) */
@Excel(name = "事假时长", readConverterExp = "小=时")
@Excel(name = "事假时长")
private Integer absenceHours;
/** 调休假时长(小时) */
@Excel(name = "调休假时长", readConverterExp = "小=时")
@Excel(name = "调休假时长")
private Integer compensatoryHours;
/** 婚假时长(小时) */
@Excel(name = "婚假时长", readConverterExp = "小=时")
@Excel(name = "婚假时长")
private Integer marriageHours;
/** 年休假时长(小时) */
@Excel(name = "年休假时长", readConverterExp = "小=时")
@Excel(name = "年休假时长")
private Integer annualHours;
/** 产假时长(小时) */
@Excel(name = "产假时长", readConverterExp = "小=时")
@Excel(name = "产假时长")
private Integer maternityHours;
/** 陪产假时长(小时) */
@Excel(name = "陪产假时长", readConverterExp = "小=时")
@Excel(name = "陪产假时长")
private Integer paternityHours;
/** 丧假时长(小时) */
@Excel(name = "丧假时长", readConverterExp = "小=时")
@Excel(name = "丧假时长")
private Integer funeralHours;
/** 工伤假时长(小时) */
@Excel(name = "工伤假时长", readConverterExp = "小=时")
@Excel(name = "工伤假时长")
private Integer workHours;
/** 删除标识 */

View File

@ -3,6 +3,7 @@ package com.evo.personnelMatters.domain;
import com.evo.common.annotation.Excel;
import com.evo.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@ -16,6 +17,7 @@ import java.math.BigDecimal;
* @author: andy.shi
* @remark: 开发人员联系方式 1042025947@qq.com/微信同步
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class RzSubsidyInfo extends BaseEntity
{

View File

@ -1,5 +1,6 @@
package com.evo.personnelMatters.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.evo.personnelMatters.domain.RzLeave;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
@ -11,7 +12,7 @@ import java.util.List;
* @author chenyj
* @date 2024-08-03
*/
public interface RzLeaveMapper
public interface RzLeaveMapper extends BaseMapper<RzLeave>
{
/**
* 查询请假管理

View File

@ -58,4 +58,5 @@ public interface IRzLeaveService
*/
public List<RzLeaveDetail> listLeaveDetails(RzLeave rzLeave);
List<RzLeave> selectRzLeaveListByDate(RzLeave rzLeave);
}

View File

@ -1,5 +1,7 @@
package com.evo.personnelMatters.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.evo.common.annotation.DataScope;
import com.evo.common.constant.Constants;
import com.evo.common.core.domain.AjaxResult;
@ -150,4 +152,12 @@ public class RzLeaveServiceImpl implements IRzLeaveService
// res_list = rzLeaveDetailMapper.selectRzLeaveDetailByLeaveId(leave.getId());
return res_list;
}
@Override
public List<RzLeave> selectRzLeaveListByDate(RzLeave rzLeave) {
LambdaQueryWrapper<RzLeave> wa = new LambdaQueryWrapper<>();
wa.like(StringUtils.isNotBlank(rzLeave.getName()),RzLeave::getName,rzLeave.getName());
wa.like(StringUtils.isNotBlank(rzLeave.getDeptName()),RzLeave::getDeptName,rzLeave.getDeptName());
return rzLeaveMapper.selectList(wa);
}
}

View File

@ -49,7 +49,7 @@ public class RzRestaurantStatisticsController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('restaurant:statistics:export')")
@Log(title = "餐饮统计", businessType = BusinessType.EXPORT)
@GetMapping("/export")
@PostMapping ("/export")
public AjaxResult export(RzRestaurantStatistics rzRestaurantStatistics)
{
ExcelUtilCy<RzRestaurantStatistics> util = new ExcelUtilCy<RzRestaurantStatistics>(RzRestaurantStatistics.class);
@ -62,7 +62,7 @@ public class RzRestaurantStatisticsController extends BaseController
List<RzRestaurantStatistics> res_list = rzRestaurantStatisticsService.selectRzRestaurantStatisticsList(rzRestaurantStatistics);
//先找到有多少个公司部门
for (RzRestaurantStatistics restaurantStatistics : res_list) {
if(sheetNameList == null || sheetNameList.size() == 0){
if(sheetNameList.isEmpty()){
sheetNameList.add(restaurantStatistics.getCompanyName());
continue;
}
@ -82,7 +82,7 @@ public class RzRestaurantStatisticsController extends BaseController
for (RzRestaurantStatistics restaurantStatistics : res_list) {
if(s.equals(restaurantStatistics.getCompanyName())){
if(null == vo_obj.getBreakfastNumber()){
vo_obj.setBreakfastNumber(0l);
vo_obj.setBreakfastNumber(0L);
}
vo_obj.setBreakfastNumber(vo_obj.getBreakfastNumber() + restaurantStatistics.getBreakfastNumber());
if(null == vo_obj.getBreakfastExpend()){

View File

@ -167,7 +167,9 @@ public class RzRestaurantImagesServiceImpl extends ServiceImpl<RzRestaurantImage
return AjaxResult.error();
}
//下发照片
eqSnDetailService.sendPhoto(Collections.asList(com.evo.equipment.constant.Constants.EQ_DEVICE_CODE), Collections.asList(Collections.asMap("userId", String.valueOf(rzRestaurantImages.getId()), "name", name, "photoUrl", com.evo.equipment.constant.Constants.STAFF_IMAGE_URL+originalFilename)));
eqSnDetailService.sendPhoto(Collections.asList(com.evo.equipment.constant.Constants.EQ_DEVICE_CODE),
Collections.asList(Collections.asMap("userId", String.valueOf(rzRestaurantImages.getId()),
"name", name, "photoUrl", com.evo.equipment.constant.Constants.STAFF_IMAGE_URL+originalFilename)));
return AjaxResult.success();
}
}

View File

@ -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;
@ -64,8 +65,19 @@ public class RzRestaurantStatisticsServiceImpl implements IRzRestaurantStatistic
public List<RzRestaurantStatistics> selectRzRestaurantStatisticsList(RzRestaurantStatistics rzRestaurantStatistics)
{
List<RzRestaurantStatistics> res_list = rzRestaurantStatisticsMapper.selectRzRestaurantStatisticsList(rzRestaurantStatistics);
for (RzRestaurantStatistics restaurantStatistics : res_list) {
restaurantStatistics.setCompanyName(deptMapper.selectDeptById(restaurantStatistics.getDeptId()).getDeptName());
try{
for (RzRestaurantStatistics restaurantStatistics : res_list) {
SysDept sysDept = deptMapper.selectDeptById(restaurantStatistics.getDeptId());
if (sysDept !=null){
restaurantStatistics.setCompanyName(deptMapper.selectDeptById(restaurantStatistics.getDeptId()).getDeptName());
}else {
restaurantStatistics.setCompanyName("1");
}
}
} catch (Exception e) {
throw new RuntimeException(e);
}
return res_list;
}

View File

@ -21,21 +21,27 @@ import com.evo.common.core.domain.BaseEntity;
public class SysStaff extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 姓名 */
@Excel(name = "姓名")
private String name;
/** 编号 */
@Excel(name = "编号")
private String code;
/** 公司 */
@Excel(name = "公司")
private String companyName;
/** 主键ID */
private Long userId;
/** 部门ID */
private Long deptId;
@Excel(name = "部门")
@TableField(exist = false)
private String deptName;
/** 编号 */
@Excel(name = "编号")
private String code;
/** 姓名 */
@Excel(name = "姓名")
private String name;
/** 身份证号 */
@Excel(name = "身份证号")
@ -57,38 +63,39 @@ public class SysStaff extends BaseEntity
@Excel(name = "住址")
private String address;
/** 学历 */
@Excel(name = "学历")
private String level;
/** 毕业学校 */
@Excel(name = "毕业学校")
private String school;
/** 专业 */
@Excel(name = "专业")
private String major;
/** 毕业学校 */
@Excel(name = "毕业学校")
private String school;
/** 银行卡号 */
@Excel(name = "银行卡号")
private String bankNumber;
/** 学历 */
@Excel(name = "学历")
private String level;
/** 开户行 */
@Excel(name = "开户行")
private String bank;
/** 银行卡号 */
@Excel(name = "银行卡号")
private String bankNumber;
/** 入职时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "入职时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date employmentDate;
/** 试用期限 */
@Excel(name = "试用期限")
private Long workerTerm;
/** 履历 */
@Excel(name = "履历")
private String experience;
/** 试用期限 */
@Excel(name = "试用期限")
private Long workerTerm;
/** 转正日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@ -117,6 +124,7 @@ public class SysStaff extends BaseEntity
/** 社保 */
@Excel(name = "社保")
private String socialType;
@Excel(name = "是否新农合")
private String socialSubsidy;
@ -161,10 +169,6 @@ public class SysStaff extends BaseEntity
@Excel(name = "全额工资时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date wagesRatioDate;
/** 公司 */
@Excel(name = "公司")
private String companyName;
/** 备注 */
@Excel(name = "备注")
private String remarks;

View File

@ -6,14 +6,14 @@ import java.math.BigDecimal;
import java.util.Date;
public class SysStaffVo {
/** 姓名 */
@Excel(name = "* 姓名")
private String name;
@Excel(name = "* 部门")
private String deptName;
/** 编号 */
@Excel(name = "编号")
private String code;
/** 姓名 */
@Excel(name = "* 姓名")
private String name;
/** 身份证号 */
@Excel(name = "* 身份证号")
private String idCard;

View File

@ -17,6 +17,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="workHours" column="work_hours" />
<result property="nightNumber" column="night_number" />
<result property="middleShiftNumber" column="middle_shift_number" />
<result property="holidayType" column="holiday_type" />
<result property="remarks" column="remarks" />
<result property="delFlag" column="del_flag" />
<result property="createBy" column="create_by" />
@ -28,7 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectRzAttendanceVo">
select id, staff_id, name, dept_id, attendance_date, rules, work_start_time,ycs_flag,ycx_flag, work_end_time, work_sum,work_hours,night_number,middle_shift_number,remarks, del_flag, create_by, create_time, update_by, update_time from rz_attendance
select id, staff_id, name, dept_id, attendance_date, rules, work_start_time,ycs_flag,ycx_flag, work_end_time, work_sum,work_hours,night_number,middle_shift_number,holiday_type,remarks, del_flag, create_by, create_time, update_by, update_time from rz_attendance
</sql>
<select id="selectRzAttendanceList" parameterType="RzAttendance" resultMap="RzAttendanceResult">
@ -69,6 +70,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="workSum != null">work_sum = #{workSum},</if>
<if test="nightNumber != null">night_number = #{nightNumber},</if>
<if test="middleShiftNumber != null">middle_shift_number = #{middleShiftNumber},</if>
<if test="holidayType != null">holiday_type = #{holidayType},</if>
<if test="remarks != null">remarks = #{remarks},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createBy != null">create_by = #{createBy},</if>