- 在IWmsAttendanceScheduleService中新增generateSchedule方法 - 在WmsAttendanceScheduleController中添加生成排班API接口 - 实现WmsAttendanceScheduleServiceImpl中的排班生成逻辑,支持正常排班和倒班 - 扩展WmsAttendanceShiftRule实体类,添加倒班转换班次字段 - 更新WmsAttendanceShiftRule相关BO、VO类及数据库映射 - 创建GenerateScheduleBo请求对象用于接收排班生成参数 - 实现倒班规则查询和班次验证功能 - 添加排班重复性检查机制
111 lines
3.8 KiB
Java
111 lines
3.8 KiB
Java
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.domain.bo.GenerateScheduleBo;
|
|
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));
|
|
}
|
|
|
|
/**
|
|
* 生成排班
|
|
*/
|
|
@Log(title = "生成排班", businessType = BusinessType.INSERT)
|
|
@PostMapping("/generate")
|
|
public R<Void> generateSchedule(@Validated @RequestBody GenerateScheduleBo bo) {
|
|
iWmsAttendanceScheduleService.generateSchedule(bo);
|
|
return R.ok();
|
|
}
|
|
}
|