feat(wms): 添加考勤排班、班次及倒班规则功能模块
- 新增 IWmsAttendanceScheduleService 接口及其实现类 - 新增 IWmsAttendanceShiftService 接口及其实现类 - 新增 IWmsAttendanceShiftRuleService 接口及其实现类 - 添加 WmsAttendanceSchedule、WmsAttendanceShift、WmsAttendanceShiftRule 实体类 - 创建对应的 BO 和 VO 类用于数据传输 - 添加 WmsAttendanceScheduleController、WmsAttendanceShiftController、WmsAttendanceShiftRuleController 控制器 - 新增相应的 Mapper 接口和 XML 映射文件 - 实现分页查询、新增、修改、删除等基础功能 - 集成 Excel 导出功能和数据校验机制
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
package com.klp.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.*;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.klp.common.annotation.RepeatSubmit;
|
||||
import com.klp.common.annotation.Log;
|
||||
import com.klp.common.core.controller.BaseController;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.common.core.validate.AddGroup;
|
||||
import com.klp.common.core.validate.EditGroup;
|
||||
import com.klp.common.enums.BusinessType;
|
||||
import com.klp.common.utils.poi.ExcelUtil;
|
||||
import com.klp.domain.vo.WmsAttendanceScheduleVo;
|
||||
import com.klp.domain.bo.WmsAttendanceScheduleBo;
|
||||
import com.klp.service.IWmsAttendanceScheduleService;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 排班(谁在哪天上班)
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-08
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/wms/attendanceSchedule")
|
||||
public class WmsAttendanceScheduleController extends BaseController {
|
||||
|
||||
private final IWmsAttendanceScheduleService iWmsAttendanceScheduleService;
|
||||
|
||||
/**
|
||||
* 查询排班(谁在哪天上班)列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<WmsAttendanceScheduleVo> list(WmsAttendanceScheduleBo bo, PageQuery pageQuery) {
|
||||
return iWmsAttendanceScheduleService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出排班(谁在哪天上班)列表
|
||||
*/
|
||||
@Log(title = "排班(谁在哪天上班)", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(WmsAttendanceScheduleBo bo, HttpServletResponse response) {
|
||||
List<WmsAttendanceScheduleVo> list = iWmsAttendanceScheduleService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "排班(谁在哪天上班)", WmsAttendanceScheduleVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取排班(谁在哪天上班)详细信息
|
||||
*
|
||||
* @param scheduleId 主键
|
||||
*/
|
||||
@GetMapping("/{scheduleId}")
|
||||
public R<WmsAttendanceScheduleVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long scheduleId) {
|
||||
return R.ok(iWmsAttendanceScheduleService.queryById(scheduleId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增排班(谁在哪天上班)
|
||||
*/
|
||||
@Log(title = "排班(谁在哪天上班)", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody WmsAttendanceScheduleBo bo) {
|
||||
return toAjax(iWmsAttendanceScheduleService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改排班(谁在哪天上班)
|
||||
*/
|
||||
@Log(title = "排班(谁在哪天上班)", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody WmsAttendanceScheduleBo bo) {
|
||||
return toAjax(iWmsAttendanceScheduleService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除排班(谁在哪天上班)
|
||||
*
|
||||
* @param scheduleIds 主键串
|
||||
*/
|
||||
@Log(title = "排班(谁在哪天上班)", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{scheduleIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] scheduleIds) {
|
||||
return toAjax(iWmsAttendanceScheduleService.deleteWithValidByIds(Arrays.asList(scheduleIds), true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.klp.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.*;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.klp.common.annotation.RepeatSubmit;
|
||||
import com.klp.common.annotation.Log;
|
||||
import com.klp.common.core.controller.BaseController;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.common.core.validate.AddGroup;
|
||||
import com.klp.common.core.validate.EditGroup;
|
||||
import com.klp.common.enums.BusinessType;
|
||||
import com.klp.common.utils.poi.ExcelUtil;
|
||||
import com.klp.domain.vo.WmsAttendanceShiftVo;
|
||||
import com.klp.domain.bo.WmsAttendanceShiftBo;
|
||||
import com.klp.service.IWmsAttendanceShiftService;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 班次
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-08
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/wms/attendanceShift")
|
||||
public class WmsAttendanceShiftController extends BaseController {
|
||||
|
||||
private final IWmsAttendanceShiftService iWmsAttendanceShiftService;
|
||||
|
||||
/**
|
||||
* 查询班次列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<WmsAttendanceShiftVo> list(WmsAttendanceShiftBo bo, PageQuery pageQuery) {
|
||||
return iWmsAttendanceShiftService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出班次列表
|
||||
*/
|
||||
@Log(title = "班次", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(WmsAttendanceShiftBo bo, HttpServletResponse response) {
|
||||
List<WmsAttendanceShiftVo> list = iWmsAttendanceShiftService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "班次", WmsAttendanceShiftVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取班次详细信息
|
||||
*
|
||||
* @param shiftId 主键
|
||||
*/
|
||||
@GetMapping("/{shiftId}")
|
||||
public R<WmsAttendanceShiftVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long shiftId) {
|
||||
return R.ok(iWmsAttendanceShiftService.queryById(shiftId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增班次
|
||||
*/
|
||||
@Log(title = "班次", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody WmsAttendanceShiftBo bo) {
|
||||
return toAjax(iWmsAttendanceShiftService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改班次
|
||||
*/
|
||||
@Log(title = "班次", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody WmsAttendanceShiftBo bo) {
|
||||
return toAjax(iWmsAttendanceShiftService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除班次
|
||||
*
|
||||
* @param shiftIds 主键串
|
||||
*/
|
||||
@Log(title = "班次", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{shiftIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] shiftIds) {
|
||||
return toAjax(iWmsAttendanceShiftService.deleteWithValidByIds(Arrays.asList(shiftIds), true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.klp.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.*;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.klp.common.annotation.RepeatSubmit;
|
||||
import com.klp.common.annotation.Log;
|
||||
import com.klp.common.core.controller.BaseController;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.common.core.validate.AddGroup;
|
||||
import com.klp.common.core.validate.EditGroup;
|
||||
import com.klp.common.enums.BusinessType;
|
||||
import com.klp.common.utils.poi.ExcelUtil;
|
||||
import com.klp.domain.vo.WmsAttendanceShiftRuleVo;
|
||||
import com.klp.domain.bo.WmsAttendanceShiftRuleBo;
|
||||
import com.klp.service.IWmsAttendanceShiftRuleService;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 倒班规则(支持按日期或按周期自动切换班次)
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-08
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/wms/attendanceShiftRule")
|
||||
public class WmsAttendanceShiftRuleController extends BaseController {
|
||||
|
||||
private final IWmsAttendanceShiftRuleService iWmsAttendanceShiftRuleService;
|
||||
|
||||
/**
|
||||
* 查询倒班规则(支持按日期或按周期自动切换班次)列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<WmsAttendanceShiftRuleVo> list(WmsAttendanceShiftRuleBo bo, PageQuery pageQuery) {
|
||||
return iWmsAttendanceShiftRuleService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出倒班规则(支持按日期或按周期自动切换班次)列表
|
||||
*/
|
||||
@Log(title = "倒班规则(支持按日期或按周期自动切换班次)", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(WmsAttendanceShiftRuleBo bo, HttpServletResponse response) {
|
||||
List<WmsAttendanceShiftRuleVo> list = iWmsAttendanceShiftRuleService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "倒班规则(支持按日期或按周期自动切换班次)", WmsAttendanceShiftRuleVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取倒班规则(支持按日期或按周期自动切换班次)详细信息
|
||||
*
|
||||
* @param ruleId 主键
|
||||
*/
|
||||
@GetMapping("/{ruleId}")
|
||||
public R<WmsAttendanceShiftRuleVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long ruleId) {
|
||||
return R.ok(iWmsAttendanceShiftRuleService.queryById(ruleId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增倒班规则(支持按日期或按周期自动切换班次)
|
||||
*/
|
||||
@Log(title = "倒班规则(支持按日期或按周期自动切换班次)", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody WmsAttendanceShiftRuleBo bo) {
|
||||
return toAjax(iWmsAttendanceShiftRuleService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改倒班规则(支持按日期或按周期自动切换班次)
|
||||
*/
|
||||
@Log(title = "倒班规则(支持按日期或按周期自动切换班次)", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody WmsAttendanceShiftRuleBo bo) {
|
||||
return toAjax(iWmsAttendanceShiftRuleService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除倒班规则(支持按日期或按周期自动切换班次)
|
||||
*
|
||||
* @param ruleIds 主键串
|
||||
*/
|
||||
@Log(title = "倒班规则(支持按日期或按周期自动切换班次)", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ruleIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ruleIds) {
|
||||
return toAjax(iWmsAttendanceShiftRuleService.deleteWithValidByIds(Arrays.asList(ruleIds), true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.klp.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
/**
|
||||
* 排班(谁在哪天上班)对象 wms_attendance_schedule
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-08
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("wms_attendance_schedule")
|
||||
public class WmsAttendanceSchedule extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId(value = "schedule_id")
|
||||
private Long scheduleId;
|
||||
/**
|
||||
* 员工ID
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 日期
|
||||
*/
|
||||
private Date workDate;
|
||||
/**
|
||||
* 班次ID
|
||||
*/
|
||||
private Long shiftId;
|
||||
/**
|
||||
* 班次名称
|
||||
*/
|
||||
private String shiftName;
|
||||
/**
|
||||
* 班组(倒班用)
|
||||
*/
|
||||
private String shiftGroup;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 删除标记(0正常 1删除)
|
||||
*/
|
||||
@TableLogic
|
||||
private Long delFlag;
|
||||
|
||||
}
|
||||
76
klp-wms/src/main/java/com/klp/domain/WmsAttendanceShift.java
Normal file
76
klp-wms/src/main/java/com/klp/domain/WmsAttendanceShift.java
Normal file
@@ -0,0 +1,76 @@
|
||||
package com.klp.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
/**
|
||||
* 班次对象 wms_attendance_shift
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-08
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("wms_attendance_shift")
|
||||
public class WmsAttendanceShift extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId(value = "shift_id")
|
||||
private Long shiftId;
|
||||
/**
|
||||
* 班次名称(长白/夜班/办公)
|
||||
*/
|
||||
private String shiftName;
|
||||
/**
|
||||
* 班次类型(白班/夜班)
|
||||
*/
|
||||
private String shiftType;
|
||||
/**
|
||||
* 季节(夏季/冬季)
|
||||
*/
|
||||
private String season;
|
||||
/**
|
||||
* 上班1
|
||||
*/
|
||||
private Date startTime;
|
||||
/**
|
||||
* 下班1
|
||||
*/
|
||||
private Date endTime;
|
||||
/**
|
||||
* 上班2
|
||||
*/
|
||||
private Date startTime2;
|
||||
/**
|
||||
* 下班2
|
||||
*/
|
||||
private Date endTime2;
|
||||
/**
|
||||
* 是否跨天
|
||||
*/
|
||||
private Long isCrossDay;
|
||||
/**
|
||||
* 工时(如18小时)
|
||||
*/
|
||||
private BigDecimal workHours;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 删除标记(0正常 1删除)
|
||||
*/
|
||||
@TableLogic
|
||||
private Long delFlag;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.klp.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
||||
/**
|
||||
* 倒班规则(支持按日期或按周期自动切换班次)对象 wms_attendance_shift_rule
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-08
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("wms_attendance_shift_rule")
|
||||
public class WmsAttendanceShiftRule extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId(value = "rule_id")
|
||||
private Long ruleId;
|
||||
/**
|
||||
* 规则类型(date=按日期倒班 / cycle=按周期倒班)
|
||||
*/
|
||||
private String ruleType;
|
||||
/**
|
||||
* 倒班日期(如:1,11,21,31)
|
||||
*/
|
||||
private String changeDays;
|
||||
/**
|
||||
* 周期天数(如每10天倒班)
|
||||
*/
|
||||
private Long cycleDays;
|
||||
/**
|
||||
* 班次A(通常白班ID)
|
||||
*/
|
||||
private Long shiftA;
|
||||
/**
|
||||
* 班次B(通常夜班ID)
|
||||
*/
|
||||
private Long shiftB;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 删除标记(0正常 1删除)
|
||||
*/
|
||||
@TableLogic
|
||||
private Long delFlag;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.klp.domain.bo;
|
||||
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
/**
|
||||
* 排班(谁在哪天上班)业务对象 wms_attendance_schedule
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-08
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class WmsAttendanceScheduleBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
private Long scheduleId;
|
||||
|
||||
/**
|
||||
* 员工ID
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 日期
|
||||
*/
|
||||
private Date workDate;
|
||||
|
||||
/**
|
||||
* 班次ID
|
||||
*/
|
||||
private Long shiftId;
|
||||
|
||||
/**
|
||||
* 班次名称
|
||||
*/
|
||||
private String shiftName;
|
||||
|
||||
/**
|
||||
* 班组(倒班用)
|
||||
*/
|
||||
private String shiftGroup;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.klp.domain.bo;
|
||||
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
/**
|
||||
* 班次业务对象 wms_attendance_shift
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-08
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class WmsAttendanceShiftBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
private Long shiftId;
|
||||
|
||||
/**
|
||||
* 班次名称(长白/夜班/办公)
|
||||
*/
|
||||
private String shiftName;
|
||||
|
||||
/**
|
||||
* 班次类型(白班/夜班)
|
||||
*/
|
||||
private String shiftType;
|
||||
|
||||
/**
|
||||
* 季节(夏季/冬季)
|
||||
*/
|
||||
private String season;
|
||||
|
||||
/**
|
||||
* 上班1
|
||||
*/
|
||||
private Date startTime;
|
||||
|
||||
/**
|
||||
* 下班1
|
||||
*/
|
||||
private Date endTime;
|
||||
|
||||
/**
|
||||
* 上班2
|
||||
*/
|
||||
private Date startTime2;
|
||||
|
||||
/**
|
||||
* 下班2
|
||||
*/
|
||||
private Date endTime2;
|
||||
|
||||
/**
|
||||
* 是否跨天
|
||||
*/
|
||||
private Long isCrossDay;
|
||||
|
||||
/**
|
||||
* 工时(如18小时)
|
||||
*/
|
||||
private BigDecimal workHours;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.klp.domain.bo;
|
||||
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
|
||||
/**
|
||||
* 倒班规则(支持按日期或按周期自动切换班次)业务对象 wms_attendance_shift_rule
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-08
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class WmsAttendanceShiftRuleBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
private Long ruleId;
|
||||
|
||||
/**
|
||||
* 规则类型(date=按日期倒班 / cycle=按周期倒班)
|
||||
*/
|
||||
private String ruleType;
|
||||
|
||||
/**
|
||||
* 倒班日期(如:1,11,21,31)
|
||||
*/
|
||||
private String changeDays;
|
||||
|
||||
/**
|
||||
* 周期天数(如每10天倒班)
|
||||
*/
|
||||
private Long cycleDays;
|
||||
|
||||
/**
|
||||
* 班次A(通常白班ID)
|
||||
*/
|
||||
private Long shiftA;
|
||||
|
||||
/**
|
||||
* 班次B(通常夜班ID)
|
||||
*/
|
||||
private Long shiftB;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.klp.domain.vo;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.klp.common.annotation.ExcelDictFormat;
|
||||
import com.klp.common.convert.ExcelDictConvert;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 排班(谁在哪天上班)视图对象 wms_attendance_schedule
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-08
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class WmsAttendanceScheduleVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@ExcelProperty(value = "主键ID")
|
||||
private Long scheduleId;
|
||||
|
||||
/**
|
||||
* 员工ID
|
||||
*/
|
||||
@ExcelProperty(value = "员工ID")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 日期
|
||||
*/
|
||||
@ExcelProperty(value = "日期")
|
||||
private Date workDate;
|
||||
|
||||
/**
|
||||
* 班次ID
|
||||
*/
|
||||
@ExcelProperty(value = "班次ID")
|
||||
private Long shiftId;
|
||||
|
||||
/**
|
||||
* 班次名称
|
||||
*/
|
||||
@ExcelProperty(value = "班次名称")
|
||||
private String shiftName;
|
||||
|
||||
/**
|
||||
* 班组(倒班用)
|
||||
*/
|
||||
@ExcelProperty(value = "班组", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "倒=班用")
|
||||
private String shiftGroup;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.klp.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.klp.common.annotation.ExcelDictFormat;
|
||||
import com.klp.common.convert.ExcelDictConvert;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 倒班规则(支持按日期或按周期自动切换班次)视图对象 wms_attendance_shift_rule
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-08
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class WmsAttendanceShiftRuleVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@ExcelProperty(value = "主键ID")
|
||||
private Long ruleId;
|
||||
|
||||
/**
|
||||
* 规则类型(date=按日期倒班 / cycle=按周期倒班)
|
||||
*/
|
||||
@ExcelProperty(value = "规则类型", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "d=ate=按日期倒班,/=,c=ycle=按周期倒班")
|
||||
private String ruleType;
|
||||
|
||||
/**
|
||||
* 倒班日期(如:1,11,21,31)
|
||||
*/
|
||||
@ExcelProperty(value = "倒班日期", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "如=:1,11,21,31")
|
||||
private String changeDays;
|
||||
|
||||
/**
|
||||
* 周期天数(如每10天倒班)
|
||||
*/
|
||||
@ExcelProperty(value = "周期天数", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "如=每10天倒班")
|
||||
private Long cycleDays;
|
||||
|
||||
/**
|
||||
* 班次A(通常白班ID)
|
||||
*/
|
||||
@ExcelProperty(value = "班次A", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "通=常白班ID")
|
||||
private Long shiftA;
|
||||
|
||||
/**
|
||||
* 班次B(通常夜班ID)
|
||||
*/
|
||||
@ExcelProperty(value = "班次B", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "通=常夜班ID")
|
||||
private Long shiftB;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package com.klp.domain.vo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.klp.common.annotation.ExcelDictFormat;
|
||||
import com.klp.common.convert.ExcelDictConvert;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 班次视图对象 wms_attendance_shift
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-08
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class WmsAttendanceShiftVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@ExcelProperty(value = "主键ID")
|
||||
private Long shiftId;
|
||||
|
||||
/**
|
||||
* 班次名称(长白/夜班/办公)
|
||||
*/
|
||||
@ExcelProperty(value = "班次名称", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "长=白/夜班/办公")
|
||||
private String shiftName;
|
||||
|
||||
/**
|
||||
* 班次类型(白班/夜班)
|
||||
*/
|
||||
@ExcelProperty(value = "班次类型", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "白=班/夜班")
|
||||
private String shiftType;
|
||||
|
||||
/**
|
||||
* 季节(夏季/冬季)
|
||||
*/
|
||||
@ExcelProperty(value = "季节", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "夏=季/冬季")
|
||||
private String season;
|
||||
|
||||
/**
|
||||
* 上班1
|
||||
*/
|
||||
@ExcelProperty(value = "上班1")
|
||||
private Date startTime;
|
||||
|
||||
/**
|
||||
* 下班1
|
||||
*/
|
||||
@ExcelProperty(value = "下班1")
|
||||
private Date endTime;
|
||||
|
||||
/**
|
||||
* 上班2
|
||||
*/
|
||||
@ExcelProperty(value = "上班2")
|
||||
private Date startTime2;
|
||||
|
||||
/**
|
||||
* 下班2
|
||||
*/
|
||||
@ExcelProperty(value = "下班2")
|
||||
private Date endTime2;
|
||||
|
||||
/**
|
||||
* 是否跨天
|
||||
*/
|
||||
@ExcelProperty(value = "是否跨天")
|
||||
private Long isCrossDay;
|
||||
|
||||
/**
|
||||
* 工时(如18小时)
|
||||
*/
|
||||
@ExcelProperty(value = "工时", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "如=18小时")
|
||||
private BigDecimal workHours;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.klp.mapper;
|
||||
|
||||
import com.klp.domain.WmsAttendanceSchedule;
|
||||
import com.klp.domain.vo.WmsAttendanceScheduleVo;
|
||||
import com.klp.common.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 排班(谁在哪天上班)Mapper接口
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-08
|
||||
*/
|
||||
public interface WmsAttendanceScheduleMapper extends BaseMapperPlus<WmsAttendanceScheduleMapper, WmsAttendanceSchedule, WmsAttendanceScheduleVo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.klp.mapper;
|
||||
|
||||
import com.klp.domain.WmsAttendanceShift;
|
||||
import com.klp.domain.vo.WmsAttendanceShiftVo;
|
||||
import com.klp.common.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 班次Mapper接口
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-08
|
||||
*/
|
||||
public interface WmsAttendanceShiftMapper extends BaseMapperPlus<WmsAttendanceShiftMapper, WmsAttendanceShift, WmsAttendanceShiftVo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.klp.mapper;
|
||||
|
||||
import com.klp.domain.WmsAttendanceShiftRule;
|
||||
import com.klp.domain.vo.WmsAttendanceShiftRuleVo;
|
||||
import com.klp.common.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 倒班规则(支持按日期或按周期自动切换班次)Mapper接口
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-08
|
||||
*/
|
||||
public interface WmsAttendanceShiftRuleMapper extends BaseMapperPlus<WmsAttendanceShiftRuleMapper, WmsAttendanceShiftRule, WmsAttendanceShiftRuleVo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.klp.service;
|
||||
|
||||
import com.klp.domain.WmsAttendanceSchedule;
|
||||
import com.klp.domain.vo.WmsAttendanceScheduleVo;
|
||||
import com.klp.domain.bo.WmsAttendanceScheduleBo;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 排班(谁在哪天上班)Service接口
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-08
|
||||
*/
|
||||
public interface IWmsAttendanceScheduleService {
|
||||
|
||||
/**
|
||||
* 查询排班(谁在哪天上班)
|
||||
*/
|
||||
WmsAttendanceScheduleVo queryById(Long scheduleId);
|
||||
|
||||
/**
|
||||
* 查询排班(谁在哪天上班)列表
|
||||
*/
|
||||
TableDataInfo<WmsAttendanceScheduleVo> queryPageList(WmsAttendanceScheduleBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询排班(谁在哪天上班)列表
|
||||
*/
|
||||
List<WmsAttendanceScheduleVo> queryList(WmsAttendanceScheduleBo bo);
|
||||
|
||||
/**
|
||||
* 新增排班(谁在哪天上班)
|
||||
*/
|
||||
Boolean insertByBo(WmsAttendanceScheduleBo bo);
|
||||
|
||||
/**
|
||||
* 修改排班(谁在哪天上班)
|
||||
*/
|
||||
Boolean updateByBo(WmsAttendanceScheduleBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除排班(谁在哪天上班)信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.klp.service;
|
||||
|
||||
import com.klp.domain.WmsAttendanceShiftRule;
|
||||
import com.klp.domain.vo.WmsAttendanceShiftRuleVo;
|
||||
import com.klp.domain.bo.WmsAttendanceShiftRuleBo;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 倒班规则(支持按日期或按周期自动切换班次)Service接口
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-08
|
||||
*/
|
||||
public interface IWmsAttendanceShiftRuleService {
|
||||
|
||||
/**
|
||||
* 查询倒班规则(支持按日期或按周期自动切换班次)
|
||||
*/
|
||||
WmsAttendanceShiftRuleVo queryById(Long ruleId);
|
||||
|
||||
/**
|
||||
* 查询倒班规则(支持按日期或按周期自动切换班次)列表
|
||||
*/
|
||||
TableDataInfo<WmsAttendanceShiftRuleVo> queryPageList(WmsAttendanceShiftRuleBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询倒班规则(支持按日期或按周期自动切换班次)列表
|
||||
*/
|
||||
List<WmsAttendanceShiftRuleVo> queryList(WmsAttendanceShiftRuleBo bo);
|
||||
|
||||
/**
|
||||
* 新增倒班规则(支持按日期或按周期自动切换班次)
|
||||
*/
|
||||
Boolean insertByBo(WmsAttendanceShiftRuleBo bo);
|
||||
|
||||
/**
|
||||
* 修改倒班规则(支持按日期或按周期自动切换班次)
|
||||
*/
|
||||
Boolean updateByBo(WmsAttendanceShiftRuleBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除倒班规则(支持按日期或按周期自动切换班次)信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.klp.service;
|
||||
|
||||
import com.klp.domain.WmsAttendanceShift;
|
||||
import com.klp.domain.vo.WmsAttendanceShiftVo;
|
||||
import com.klp.domain.bo.WmsAttendanceShiftBo;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 班次Service接口
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-08
|
||||
*/
|
||||
public interface IWmsAttendanceShiftService {
|
||||
|
||||
/**
|
||||
* 查询班次
|
||||
*/
|
||||
WmsAttendanceShiftVo queryById(Long shiftId);
|
||||
|
||||
/**
|
||||
* 查询班次列表
|
||||
*/
|
||||
TableDataInfo<WmsAttendanceShiftVo> queryPageList(WmsAttendanceShiftBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询班次列表
|
||||
*/
|
||||
List<WmsAttendanceShiftVo> queryList(WmsAttendanceShiftBo bo);
|
||||
|
||||
/**
|
||||
* 新增班次
|
||||
*/
|
||||
Boolean insertByBo(WmsAttendanceShiftBo bo);
|
||||
|
||||
/**
|
||||
* 修改班次
|
||||
*/
|
||||
Boolean updateByBo(WmsAttendanceShiftBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除班次信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
package com.klp.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.klp.common.utils.StringUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.klp.domain.bo.WmsAttendanceScheduleBo;
|
||||
import com.klp.domain.vo.WmsAttendanceScheduleVo;
|
||||
import com.klp.domain.WmsAttendanceSchedule;
|
||||
import com.klp.mapper.WmsAttendanceScheduleMapper;
|
||||
import com.klp.service.IWmsAttendanceScheduleService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 排班(谁在哪天上班)Service业务层处理
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-08
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class WmsAttendanceScheduleServiceImpl implements IWmsAttendanceScheduleService {
|
||||
|
||||
private final WmsAttendanceScheduleMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询排班(谁在哪天上班)
|
||||
*/
|
||||
@Override
|
||||
public WmsAttendanceScheduleVo queryById(Long scheduleId){
|
||||
return baseMapper.selectVoById(scheduleId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询排班(谁在哪天上班)列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<WmsAttendanceScheduleVo> queryPageList(WmsAttendanceScheduleBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<WmsAttendanceSchedule> lqw = buildQueryWrapper(bo);
|
||||
Page<WmsAttendanceScheduleVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询排班(谁在哪天上班)列表
|
||||
*/
|
||||
@Override
|
||||
public List<WmsAttendanceScheduleVo> queryList(WmsAttendanceScheduleBo bo) {
|
||||
LambdaQueryWrapper<WmsAttendanceSchedule> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<WmsAttendanceSchedule> buildQueryWrapper(WmsAttendanceScheduleBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<WmsAttendanceSchedule> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getUserId() != null, WmsAttendanceSchedule::getUserId, bo.getUserId());
|
||||
lqw.eq(bo.getWorkDate() != null, WmsAttendanceSchedule::getWorkDate, bo.getWorkDate());
|
||||
lqw.eq(bo.getShiftId() != null, WmsAttendanceSchedule::getShiftId, bo.getShiftId());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getShiftName()), WmsAttendanceSchedule::getShiftName, bo.getShiftName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getShiftGroup()), WmsAttendanceSchedule::getShiftGroup, bo.getShiftGroup());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增排班(谁在哪天上班)
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(WmsAttendanceScheduleBo bo) {
|
||||
WmsAttendanceSchedule add = BeanUtil.toBean(bo, WmsAttendanceSchedule.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setScheduleId(add.getScheduleId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改排班(谁在哪天上班)
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(WmsAttendanceScheduleBo bo) {
|
||||
WmsAttendanceSchedule update = BeanUtil.toBean(bo, WmsAttendanceSchedule.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(WmsAttendanceSchedule entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除排班(谁在哪天上班)
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
package com.klp.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.klp.common.utils.StringUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.klp.domain.bo.WmsAttendanceShiftRuleBo;
|
||||
import com.klp.domain.vo.WmsAttendanceShiftRuleVo;
|
||||
import com.klp.domain.WmsAttendanceShiftRule;
|
||||
import com.klp.mapper.WmsAttendanceShiftRuleMapper;
|
||||
import com.klp.service.IWmsAttendanceShiftRuleService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 倒班规则(支持按日期或按周期自动切换班次)Service业务层处理
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-08
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class WmsAttendanceShiftRuleServiceImpl implements IWmsAttendanceShiftRuleService {
|
||||
|
||||
private final WmsAttendanceShiftRuleMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询倒班规则(支持按日期或按周期自动切换班次)
|
||||
*/
|
||||
@Override
|
||||
public WmsAttendanceShiftRuleVo queryById(Long ruleId){
|
||||
return baseMapper.selectVoById(ruleId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询倒班规则(支持按日期或按周期自动切换班次)列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<WmsAttendanceShiftRuleVo> queryPageList(WmsAttendanceShiftRuleBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<WmsAttendanceShiftRule> lqw = buildQueryWrapper(bo);
|
||||
Page<WmsAttendanceShiftRuleVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询倒班规则(支持按日期或按周期自动切换班次)列表
|
||||
*/
|
||||
@Override
|
||||
public List<WmsAttendanceShiftRuleVo> queryList(WmsAttendanceShiftRuleBo bo) {
|
||||
LambdaQueryWrapper<WmsAttendanceShiftRule> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<WmsAttendanceShiftRule> buildQueryWrapper(WmsAttendanceShiftRuleBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<WmsAttendanceShiftRule> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getRuleType()), WmsAttendanceShiftRule::getRuleType, bo.getRuleType());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getChangeDays()), WmsAttendanceShiftRule::getChangeDays, bo.getChangeDays());
|
||||
lqw.eq(bo.getCycleDays() != null, WmsAttendanceShiftRule::getCycleDays, bo.getCycleDays());
|
||||
lqw.eq(bo.getShiftA() != null, WmsAttendanceShiftRule::getShiftA, bo.getShiftA());
|
||||
lqw.eq(bo.getShiftB() != null, WmsAttendanceShiftRule::getShiftB, bo.getShiftB());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增倒班规则(支持按日期或按周期自动切换班次)
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(WmsAttendanceShiftRuleBo bo) {
|
||||
WmsAttendanceShiftRule add = BeanUtil.toBean(bo, WmsAttendanceShiftRule.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setRuleId(add.getRuleId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改倒班规则(支持按日期或按周期自动切换班次)
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(WmsAttendanceShiftRuleBo bo) {
|
||||
WmsAttendanceShiftRule update = BeanUtil.toBean(bo, WmsAttendanceShiftRule.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(WmsAttendanceShiftRule entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除倒班规则(支持按日期或按周期自动切换班次)
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
package com.klp.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.klp.common.utils.StringUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.klp.domain.bo.WmsAttendanceShiftBo;
|
||||
import com.klp.domain.vo.WmsAttendanceShiftVo;
|
||||
import com.klp.domain.WmsAttendanceShift;
|
||||
import com.klp.mapper.WmsAttendanceShiftMapper;
|
||||
import com.klp.service.IWmsAttendanceShiftService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 班次Service业务层处理
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-08
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class WmsAttendanceShiftServiceImpl implements IWmsAttendanceShiftService {
|
||||
|
||||
private final WmsAttendanceShiftMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询班次
|
||||
*/
|
||||
@Override
|
||||
public WmsAttendanceShiftVo queryById(Long shiftId){
|
||||
return baseMapper.selectVoById(shiftId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询班次列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<WmsAttendanceShiftVo> queryPageList(WmsAttendanceShiftBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<WmsAttendanceShift> lqw = buildQueryWrapper(bo);
|
||||
Page<WmsAttendanceShiftVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询班次列表
|
||||
*/
|
||||
@Override
|
||||
public List<WmsAttendanceShiftVo> queryList(WmsAttendanceShiftBo bo) {
|
||||
LambdaQueryWrapper<WmsAttendanceShift> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<WmsAttendanceShift> buildQueryWrapper(WmsAttendanceShiftBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<WmsAttendanceShift> lqw = Wrappers.lambdaQuery();
|
||||
lqw.like(StringUtils.isNotBlank(bo.getShiftName()), WmsAttendanceShift::getShiftName, bo.getShiftName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getShiftType()), WmsAttendanceShift::getShiftType, bo.getShiftType());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getSeason()), WmsAttendanceShift::getSeason, bo.getSeason());
|
||||
lqw.eq(bo.getStartTime() != null, WmsAttendanceShift::getStartTime, bo.getStartTime());
|
||||
lqw.eq(bo.getEndTime() != null, WmsAttendanceShift::getEndTime, bo.getEndTime());
|
||||
lqw.eq(bo.getStartTime2() != null, WmsAttendanceShift::getStartTime2, bo.getStartTime2());
|
||||
lqw.eq(bo.getEndTime2() != null, WmsAttendanceShift::getEndTime2, bo.getEndTime2());
|
||||
lqw.eq(bo.getIsCrossDay() != null, WmsAttendanceShift::getIsCrossDay, bo.getIsCrossDay());
|
||||
lqw.eq(bo.getWorkHours() != null, WmsAttendanceShift::getWorkHours, bo.getWorkHours());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增班次
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(WmsAttendanceShiftBo bo) {
|
||||
WmsAttendanceShift add = BeanUtil.toBean(bo, WmsAttendanceShift.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setShiftId(add.getShiftId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改班次
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(WmsAttendanceShiftBo bo) {
|
||||
WmsAttendanceShift update = BeanUtil.toBean(bo, WmsAttendanceShift.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(WmsAttendanceShift entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除班次
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?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.klp.mapper.WmsAttendanceScheduleMapper">
|
||||
|
||||
<resultMap type="com.klp.domain.WmsAttendanceSchedule" id="WmsAttendanceScheduleResult">
|
||||
<result property="scheduleId" column="schedule_id"/>
|
||||
<result property="userId" column="user_id"/>
|
||||
<result property="workDate" column="work_date"/>
|
||||
<result property="shiftId" column="shift_id"/>
|
||||
<result property="shiftName" column="shift_name"/>
|
||||
<result property="shiftGroup" column="shift_group"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,27 @@
|
||||
<?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.klp.mapper.WmsAttendanceShiftMapper">
|
||||
|
||||
<resultMap type="com.klp.domain.WmsAttendanceShift" id="WmsAttendanceShiftResult">
|
||||
<result property="shiftId" column="shift_id"/>
|
||||
<result property="shiftName" column="shift_name"/>
|
||||
<result property="shiftType" column="shift_type"/>
|
||||
<result property="season" column="season"/>
|
||||
<result property="startTime" column="start_time"/>
|
||||
<result property="endTime" column="end_time"/>
|
||||
<result property="startTime2" column="start_time2"/>
|
||||
<result property="endTime2" column="end_time2"/>
|
||||
<result property="isCrossDay" column="is_cross_day"/>
|
||||
<result property="workHours" column="work_hours"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,23 @@
|
||||
<?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.klp.mapper.WmsAttendanceShiftRuleMapper">
|
||||
|
||||
<resultMap type="com.klp.domain.WmsAttendanceShiftRule" id="WmsAttendanceShiftRuleResult">
|
||||
<result property="ruleId" column="rule_id"/>
|
||||
<result property="ruleType" column="rule_type"/>
|
||||
<result property="changeDays" column="change_days"/>
|
||||
<result property="cycleDays" column="cycle_days"/>
|
||||
<result property="shiftA" column="shift_a"/>
|
||||
<result property="shiftB" column="shift_b"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user