Merge branch '0.8.X' of http://49.232.154.205:10100/DeXun/klp-oa into 0.8.X
This commit is contained in:
@@ -54,6 +54,10 @@ public class EqpEquipmentInspectionRecord extends BaseEntity {
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 巡检照片URL,多个用英文逗号分隔
|
||||
*/
|
||||
private String photo;
|
||||
/**
|
||||
* 删除标识 0正常 2删除
|
||||
*/
|
||||
|
||||
@@ -59,5 +59,10 @@ public class EqpEquipmentInspectionRecordBo extends BaseEntity {
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 巡检照片URL,多个用英文逗号分隔
|
||||
*/
|
||||
private String photo;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -69,5 +69,10 @@ public class EqpEquipmentInspectionRecordVo {
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 巡检照片URL,多个用英文逗号分隔
|
||||
*/
|
||||
private String photo;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -62,6 +62,7 @@ public class EqpEquipmentInspectionRecordServiceImpl implements IEqpEquipmentIns
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<EqpEquipmentInspectionRecord> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getCheckId() != null, EqpEquipmentInspectionRecord::getCheckId, bo.getCheckId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getPhoto()), EqpEquipmentInspectionRecord::getPhoto, bo.getPhoto());
|
||||
lqw.eq(bo.getShift() != null, EqpEquipmentInspectionRecord::getShift, bo.getShift());
|
||||
lqw.eq(bo.getInspectTime() != null, EqpEquipmentInspectionRecord::getInspectTime, bo.getInspectTime());
|
||||
lqw.eq(bo.getRunStatus() != null, EqpEquipmentInspectionRecord::getRunStatus, bo.getRunStatus());
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
<result property="inspector" column="inspector"/>
|
||||
<result property="abnormalDesc" column="abnormal_desc"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="photo" column="photo"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
|
||||
@@ -20,6 +20,7 @@ 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.domain.bo.BatchUpdateScheduleBo;
|
||||
import com.klp.service.IWmsAttendanceScheduleService;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
|
||||
@@ -107,4 +108,15 @@ public class WmsAttendanceScheduleController extends BaseController {
|
||||
iWmsAttendanceScheduleService.generateSchedule(boList);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量修改指定日期多个员工的班次
|
||||
*/
|
||||
@Log(title = "排班批量修改", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping("/batchUpdate")
|
||||
public R<Void> batchUpdateSchedule(@Validated @RequestBody BatchUpdateScheduleBo bo) {
|
||||
iWmsAttendanceScheduleService.batchUpdateSchedule(bo);
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.WmsReportConfigVo;
|
||||
import com.klp.domain.bo.WmsReportConfigBo;
|
||||
import com.klp.service.IWmsReportConfigService;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* WMS报通用配置
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/wms/reportConfig")
|
||||
public class WmsReportConfigController extends BaseController {
|
||||
|
||||
private final IWmsReportConfigService iWmsReportConfigService;
|
||||
|
||||
/**
|
||||
* 查询WMS报通用配置列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<WmsReportConfigVo> list(WmsReportConfigBo bo, PageQuery pageQuery) {
|
||||
return iWmsReportConfigService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出WMS报通用配置列表
|
||||
*/
|
||||
@Log(title = "WMS报通用配置", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(WmsReportConfigBo bo, HttpServletResponse response) {
|
||||
List<WmsReportConfigVo> list = iWmsReportConfigService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "WMS报通用配置", WmsReportConfigVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取WMS报通用配置详细信息
|
||||
*
|
||||
* @param configId 主键
|
||||
*/
|
||||
@GetMapping("/{configId}")
|
||||
public R<WmsReportConfigVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long configId) {
|
||||
return R.ok(iWmsReportConfigService.queryById(configId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增WMS报通用配置
|
||||
*/
|
||||
@Log(title = "WMS报通用配置", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody WmsReportConfigBo bo) {
|
||||
return toAjax(iWmsReportConfigService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改WMS报通用配置
|
||||
*/
|
||||
@Log(title = "WMS报通用配置", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody WmsReportConfigBo bo) {
|
||||
return toAjax(iWmsReportConfigService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除WMS报通用配置
|
||||
*
|
||||
* @param configIds 主键串
|
||||
*/
|
||||
@Log(title = "WMS报通用配置", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{configIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] configIds) {
|
||||
return toAjax(iWmsReportConfigService.deleteWithValidByIds(Arrays.asList(configIds), true));
|
||||
}
|
||||
}
|
||||
49
klp-wms/src/main/java/com/klp/domain/WmsReportConfig.java
Normal file
49
klp-wms/src/main/java/com/klp/domain/WmsReportConfig.java
Normal file
@@ -0,0 +1,49 @@
|
||||
package com.klp.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
||||
/**
|
||||
* WMS报通用配置对象 wms_report_config
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("wms_report_config")
|
||||
public class WmsReportConfig extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId(value = "config_id")
|
||||
private Long configId;
|
||||
/**
|
||||
* 报表唯一编码(如:attendance_report、coil_report)
|
||||
*/
|
||||
private String reportCode;
|
||||
/**
|
||||
* 报表名称
|
||||
*/
|
||||
private String reportName;
|
||||
/**
|
||||
* 报表配置JSON(列配置、查询条件、样式、权限等)
|
||||
*/
|
||||
private String configJson;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 删除标识 0正常 2删除
|
||||
*/
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.klp.domain.bo;
|
||||
|
||||
import lombok.Data;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class BatchUpdateScheduleBo {
|
||||
|
||||
@NotEmpty(message = "员工ID列表不能为空")
|
||||
private List<Long> userIds;
|
||||
|
||||
@NotNull(message = "日期不能为空")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date workDate;
|
||||
|
||||
@NotNull(message = "班次ID不能为空")
|
||||
private Long shiftId;
|
||||
|
||||
private String shiftName;
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.klp.domain.bo;
|
||||
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
|
||||
/**
|
||||
* WMS报通用配置业务对象 wms_report_config
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class WmsReportConfigBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
private Long configId;
|
||||
|
||||
/**
|
||||
* 报表唯一编码(如:attendance_report、coil_report)
|
||||
*/
|
||||
private String reportCode;
|
||||
|
||||
/**
|
||||
* 报表名称
|
||||
*/
|
||||
private String reportName;
|
||||
|
||||
/**
|
||||
* 报表配置JSON(列配置、查询条件、样式、权限等)
|
||||
*/
|
||||
private String configJson;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
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报通用配置视图对象 wms_report_config
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class WmsReportConfigVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@ExcelProperty(value = "主键ID")
|
||||
private Long configId;
|
||||
|
||||
/**
|
||||
* 报表唯一编码(如:attendance_report、coil_report)
|
||||
*/
|
||||
@ExcelProperty(value = "报表唯一编码", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "如=:attendance_report、coil_report")
|
||||
private String reportCode;
|
||||
|
||||
/**
|
||||
* 报表名称
|
||||
*/
|
||||
@ExcelProperty(value = "报表名称")
|
||||
private String reportName;
|
||||
|
||||
/**
|
||||
* 报表配置JSON(列配置、查询条件、样式、权限等)
|
||||
*/
|
||||
@ExcelProperty(value = "报表配置JSON", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "列=配置、查询条件、样式、权限等")
|
||||
private String configJson;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.klp.mapper;
|
||||
|
||||
import com.klp.domain.WmsReportConfig;
|
||||
import com.klp.domain.vo.WmsReportConfigVo;
|
||||
import com.klp.common.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* WMS报通用配置Mapper接口
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
public interface WmsReportConfigMapper extends BaseMapperPlus<WmsReportConfigMapper, WmsReportConfig, WmsReportConfigVo> {
|
||||
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import com.klp.domain.WmsAttendanceSchedule;
|
||||
import com.klp.domain.vo.WmsAttendanceScheduleVo;
|
||||
import com.klp.domain.bo.WmsAttendanceScheduleBo;
|
||||
import com.klp.domain.bo.GenerateScheduleBo;
|
||||
import com.klp.domain.bo.BatchUpdateScheduleBo;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
|
||||
@@ -52,4 +53,9 @@ public interface IWmsAttendanceScheduleService {
|
||||
* 生成排班
|
||||
*/
|
||||
void generateSchedule(List<GenerateScheduleBo> boList);
|
||||
|
||||
/**
|
||||
* 批量修改指定日期多个员工的班次
|
||||
*/
|
||||
void batchUpdateSchedule(BatchUpdateScheduleBo bo);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.klp.service;
|
||||
|
||||
import com.klp.domain.WmsReportConfig;
|
||||
import com.klp.domain.vo.WmsReportConfigVo;
|
||||
import com.klp.domain.bo.WmsReportConfigBo;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* WMS报通用配置Service接口
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
public interface IWmsReportConfigService {
|
||||
|
||||
/**
|
||||
* 查询WMS报通用配置
|
||||
*/
|
||||
WmsReportConfigVo queryById(Long configId);
|
||||
|
||||
/**
|
||||
* 查询WMS报通用配置列表
|
||||
*/
|
||||
TableDataInfo<WmsReportConfigVo> queryPageList(WmsReportConfigBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询WMS报通用配置列表
|
||||
*/
|
||||
List<WmsReportConfigVo> queryList(WmsReportConfigBo bo);
|
||||
|
||||
/**
|
||||
* 新增WMS报通用配置
|
||||
*/
|
||||
Boolean insertByBo(WmsReportConfigBo bo);
|
||||
|
||||
/**
|
||||
* 修改WMS报通用配置
|
||||
*/
|
||||
Boolean updateByBo(WmsReportConfigBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除WMS报通用配置信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.klp.domain.bo.WmsAttendanceScheduleBo;
|
||||
import com.klp.domain.bo.GenerateScheduleBo;
|
||||
import com.klp.domain.bo.BatchUpdateScheduleBo;
|
||||
import com.klp.domain.vo.WmsAttendanceScheduleVo;
|
||||
import com.klp.domain.WmsAttendanceSchedule;
|
||||
import com.klp.domain.WmsAttendanceShiftRule;
|
||||
@@ -149,6 +150,48 @@ public class WmsAttendanceScheduleServiceImpl implements IWmsAttendanceScheduleS
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量修改指定日期多个员工的班次
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void batchUpdateSchedule(BatchUpdateScheduleBo bo) {
|
||||
Date workDate = bo.getWorkDate();
|
||||
Long shiftId = bo.getShiftId();
|
||||
String shiftName = bo.getShiftName();
|
||||
List<Long> userIds = bo.getUserIds();
|
||||
|
||||
baseMapper.update(null, Wrappers.<WmsAttendanceSchedule>lambdaUpdate()
|
||||
.in(WmsAttendanceSchedule::getUserId, userIds)
|
||||
.eq(WmsAttendanceSchedule::getWorkDate, workDate)
|
||||
.set(WmsAttendanceSchedule::getShiftId, shiftId)
|
||||
.set(WmsAttendanceSchedule::getShiftName, shiftName));
|
||||
|
||||
Set<Long> existingUserIds = baseMapper.selectList(Wrappers.<WmsAttendanceSchedule>lambdaQuery()
|
||||
.in(WmsAttendanceSchedule::getUserId, userIds)
|
||||
.eq(WmsAttendanceSchedule::getWorkDate, workDate)
|
||||
.select(WmsAttendanceSchedule::getUserId))
|
||||
.stream()
|
||||
.map(WmsAttendanceSchedule::getUserId)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
List<WmsAttendanceSchedule> insertList = userIds.stream()
|
||||
.filter(uid -> !existingUserIds.contains(uid))
|
||||
.map(uid -> {
|
||||
WmsAttendanceSchedule s = new WmsAttendanceSchedule();
|
||||
s.setUserId(uid);
|
||||
s.setWorkDate(workDate);
|
||||
s.setShiftId(shiftId);
|
||||
s.setShiftName(shiftName);
|
||||
return s;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (!insertList.isEmpty()) {
|
||||
baseMapper.insertBatch(insertList);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成正常排班
|
||||
*/
|
||||
@@ -186,20 +229,28 @@ public class WmsAttendanceScheduleServiceImpl implements IWmsAttendanceScheduleS
|
||||
|
||||
/**
|
||||
* 生成倒班排班
|
||||
* 根据用户选择的倒班规则和起始日期,生成指定日期范围内的倒班排班表
|
||||
*
|
||||
* @param bo 生成排班业务对象,包含用户ID、规则ID、起始班次等信息
|
||||
* @param startDate 排班开始日期
|
||||
* @param endDate 排班结束日期
|
||||
*/
|
||||
private void generateShiftSchedule(GenerateScheduleBo bo, LocalDate startDate, LocalDate endDate) {
|
||||
// 获取倒班规则
|
||||
// 通过规则ID查询倒班规则信息
|
||||
WmsAttendanceShiftRuleVo rule = shiftRuleService.queryById(bo.getRuleId());
|
||||
if (rule == null) {
|
||||
throw new RuntimeException("倒班规则不存在");
|
||||
}
|
||||
|
||||
// 验证班次匹配
|
||||
// 检查用户选择的班次是否与规则中的班次匹配
|
||||
if (!bo.getShiftId().equals(rule.getShiftA()) && !bo.getShiftId().equals(rule.getShiftB())) {
|
||||
throw new RuntimeException("班次ID与倒班规则不匹配");
|
||||
}
|
||||
|
||||
// 获取班次信息
|
||||
// 查询规则中定义的所有班次信息,包括常规班次和特殊交接班次
|
||||
WmsAttendanceShiftVo shiftA = shiftService.queryById(rule.getShiftA());
|
||||
WmsAttendanceShiftVo shiftB = shiftService.queryById(rule.getShiftB());
|
||||
WmsAttendanceShiftVo changeShiftB = rule.getChangeShiftBId() != null ?
|
||||
@@ -212,26 +263,31 @@ public class WmsAttendanceScheduleServiceImpl implements IWmsAttendanceScheduleS
|
||||
}
|
||||
|
||||
// 一次查询整个日期范围内已存在的排班
|
||||
// 查询用户在指定日期范围内已有的排班日期,避免重复生成
|
||||
Set<LocalDate> existingDates = getExistingScheduleDates(bo.getUserId(), startDate, endDate);
|
||||
|
||||
List<WmsAttendanceSchedule> schedules = new ArrayList<>();
|
||||
LocalDate currentDate = startDate;
|
||||
long daysFromStart = 0;
|
||||
|
||||
// 确定初始班次
|
||||
boolean isCurrentShiftA = bo.getShiftId().equals(rule.getShiftA());
|
||||
long cycleDays = rule.getCycleDays() != null ? rule.getCycleDays() : 10;
|
||||
boolean firstDay = true;
|
||||
|
||||
while (!currentDate.isAfter(endDate)) {
|
||||
int dayOfMonth = currentDate.getDayOfMonth();
|
||||
|
||||
// 判断是否为交接班日(每月1日、11日、21日)
|
||||
boolean isSwapDay = !firstDay
|
||||
&& (dayOfMonth == 1 || dayOfMonth == 11 || dayOfMonth == 21)
|
||||
&& dayOfMonth != 31;
|
||||
|
||||
if (!existingDates.contains(currentDate)) {
|
||||
WmsAttendanceSchedule schedule = new WmsAttendanceSchedule();
|
||||
schedule.setUserId(bo.getUserId());
|
||||
schedule.setWorkDate(java.sql.Date.valueOf(currentDate));
|
||||
|
||||
boolean isChangeDay = daysFromStart > 0 && daysFromStart % cycleDays == 0;
|
||||
|
||||
if (isChangeDay) {
|
||||
// 处理交接班日
|
||||
if (isSwapDay) {
|
||||
if (isCurrentShiftA) {
|
||||
// 白班转夜班
|
||||
if (changeShiftB != null) {
|
||||
schedule.setShiftId(rule.getChangeShiftBId());
|
||||
schedule.setShiftName(changeShiftB.getShiftName());
|
||||
@@ -239,7 +295,6 @@ public class WmsAttendanceScheduleServiceImpl implements IWmsAttendanceScheduleS
|
||||
schedule.setShiftId(rule.getShiftB());
|
||||
schedule.setShiftName(shiftB.getShiftName());
|
||||
}
|
||||
isCurrentShiftA = false;
|
||||
} else {
|
||||
// 夜班转白班
|
||||
if (changeShiftA != null) {
|
||||
@@ -249,8 +304,9 @@ public class WmsAttendanceScheduleServiceImpl implements IWmsAttendanceScheduleS
|
||||
schedule.setShiftId(rule.getShiftA());
|
||||
schedule.setShiftName(shiftA.getShiftName());
|
||||
}
|
||||
isCurrentShiftA = true;
|
||||
}
|
||||
// 切换班次标识
|
||||
isCurrentShiftA = !isCurrentShiftA;
|
||||
} else {
|
||||
// 普通日
|
||||
if (isCurrentShiftA) {
|
||||
@@ -265,13 +321,12 @@ public class WmsAttendanceScheduleServiceImpl implements IWmsAttendanceScheduleS
|
||||
schedules.add(schedule);
|
||||
}
|
||||
currentDate = currentDate.plusDays(1);
|
||||
daysFromStart++;
|
||||
firstDay = false;
|
||||
}
|
||||
|
||||
// 批量插入
|
||||
if (!schedules.isEmpty()) {
|
||||
boolean i = baseMapper.insertBatch(schedules);
|
||||
if (!i) {
|
||||
boolean ok = baseMapper.insertBatch(schedules);
|
||||
if (!ok) {
|
||||
throw new RuntimeException("批量插入倒班排班失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
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.WmsReportConfigBo;
|
||||
import com.klp.domain.vo.WmsReportConfigVo;
|
||||
import com.klp.domain.WmsReportConfig;
|
||||
import com.klp.mapper.WmsReportConfigMapper;
|
||||
import com.klp.service.IWmsReportConfigService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* WMS报通用配置Service业务层处理
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-25
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class WmsReportConfigServiceImpl implements IWmsReportConfigService {
|
||||
|
||||
private final WmsReportConfigMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询WMS报通用配置
|
||||
*/
|
||||
@Override
|
||||
public WmsReportConfigVo queryById(Long configId){
|
||||
return baseMapper.selectVoById(configId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询WMS报通用配置列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<WmsReportConfigVo> queryPageList(WmsReportConfigBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<WmsReportConfig> lqw = buildQueryWrapper(bo);
|
||||
Page<WmsReportConfigVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询WMS报通用配置列表
|
||||
*/
|
||||
@Override
|
||||
public List<WmsReportConfigVo> queryList(WmsReportConfigBo bo) {
|
||||
LambdaQueryWrapper<WmsReportConfig> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<WmsReportConfig> buildQueryWrapper(WmsReportConfigBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<WmsReportConfig> lqw = Wrappers.lambdaQuery();
|
||||
lqw.like(StringUtils.isNotBlank(bo.getReportCode()), WmsReportConfig::getReportCode, bo.getReportCode());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getReportName()), WmsReportConfig::getReportName, bo.getReportName());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getConfigJson()), WmsReportConfig::getConfigJson, bo.getConfigJson());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getRemark()), WmsReportConfig::getRemark, bo.getRemark());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增WMS报通用配置
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(WmsReportConfigBo bo) {
|
||||
WmsReportConfig add = BeanUtil.toBean(bo, WmsReportConfig.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setConfigId(add.getConfigId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改WMS报通用配置
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(WmsReportConfigBo bo) {
|
||||
WmsReportConfig update = BeanUtil.toBean(bo, WmsReportConfig.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(WmsReportConfig entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除WMS报通用配置
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@@ -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.klp.mapper.WmsReportConfigMapper">
|
||||
|
||||
<resultMap type="com.klp.domain.WmsReportConfig" id="WmsReportConfigResult">
|
||||
<result property="configId" column="config_id"/>
|
||||
<result property="reportCode" column="report_code"/>
|
||||
<result property="reportName" column="report_name"/>
|
||||
<result property="configJson" column="config_json"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user