feat(wms): 添加员工转正接口
- 在员工异动类型中新增转正选项(类型值为2) - 更新数据库实体和业务对象中的异动类型定义 - 实现员工转正业务逻辑,包括状态验证和数据更新 - 添加转正API接口和相应的控制器方法 - 更新相关注释和文档以反映新的转正功能 - 修改Excel导出功能以支持转正类型的显示
This commit is contained in:
@@ -23,7 +23,7 @@ import com.klp.service.IWmsEmployeeChangeService;
|
|||||||
import com.klp.common.core.page.TableDataInfo;
|
import com.klp.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 员工异动(入职/离职)
|
* 员工异动(入职/离职/转正)
|
||||||
*
|
*
|
||||||
* @author klp
|
* @author klp
|
||||||
* @date 2026-03-14
|
* @date 2026-03-14
|
||||||
@@ -37,7 +37,7 @@ public class WmsEmployeeChangeController extends BaseController {
|
|||||||
private final IWmsEmployeeChangeService iWmsEmployeeChangeService;
|
private final IWmsEmployeeChangeService iWmsEmployeeChangeService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询员工异动(入职/离职)列表
|
* 查询员工异动(入职/离职/转正)列表
|
||||||
*/
|
*/
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo<WmsEmployeeChangeVo> list(WmsEmployeeChangeBo bo, PageQuery pageQuery) {
|
public TableDataInfo<WmsEmployeeChangeVo> list(WmsEmployeeChangeBo bo, PageQuery pageQuery) {
|
||||||
@@ -45,17 +45,17 @@ public class WmsEmployeeChangeController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出员工异动(入职/离职)列表
|
* 导出员工异动(入职/离职/转正)列表
|
||||||
*/
|
*/
|
||||||
@Log(title = "员工异动(入职/离职)", businessType = BusinessType.EXPORT)
|
@Log(title = "员工异动(入职/离职/转正)", businessType = BusinessType.EXPORT)
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(WmsEmployeeChangeBo bo, HttpServletResponse response) {
|
public void export(WmsEmployeeChangeBo bo, HttpServletResponse response) {
|
||||||
List<WmsEmployeeChangeVo> list = iWmsEmployeeChangeService.queryList(bo);
|
List<WmsEmployeeChangeVo> list = iWmsEmployeeChangeService.queryList(bo);
|
||||||
ExcelUtil.exportExcel(list, "员工异动(入职/离职)", WmsEmployeeChangeVo.class, response);
|
ExcelUtil.exportExcel(list, "员工异动(入职/离职/转正)", WmsEmployeeChangeVo.class, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取员工异动(入职/离职)详细信息
|
* 获取员工异动(入职/离职/转正)详细信息
|
||||||
*
|
*
|
||||||
* @param changeId 主键
|
* @param changeId 主键
|
||||||
*/
|
*/
|
||||||
@@ -66,9 +66,9 @@ public class WmsEmployeeChangeController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增员工异动(入职/离职)
|
* 新增员工异动(入职/离职/转正)
|
||||||
*/
|
*/
|
||||||
@Log(title = "员工异动(入职/离职)", businessType = BusinessType.INSERT)
|
@Log(title = "员工异动(入职/离职/转正)", businessType = BusinessType.INSERT)
|
||||||
@RepeatSubmit()
|
@RepeatSubmit()
|
||||||
@PostMapping()
|
@PostMapping()
|
||||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody WmsEmployeeChangeBo bo) {
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody WmsEmployeeChangeBo bo) {
|
||||||
@@ -76,9 +76,9 @@ public class WmsEmployeeChangeController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改员工异动(入职/离职)
|
* 修改员工异动(入职/离职/转正)
|
||||||
*/
|
*/
|
||||||
@Log(title = "员工异动(入职/离职)", businessType = BusinessType.UPDATE)
|
@Log(title = "员工异动(入职/离职/转正)", businessType = BusinessType.UPDATE)
|
||||||
@RepeatSubmit()
|
@RepeatSubmit()
|
||||||
@PutMapping()
|
@PutMapping()
|
||||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody WmsEmployeeChangeBo bo) {
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody WmsEmployeeChangeBo bo) {
|
||||||
@@ -86,11 +86,11 @@ public class WmsEmployeeChangeController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除员工异动(入职/离职)
|
* 删除员工异动(入职/离职/转正)
|
||||||
*
|
*
|
||||||
* @param changeIds 主键串
|
* @param changeIds 主键串
|
||||||
*/
|
*/
|
||||||
@Log(title = "员工异动(入职/离职)", businessType = BusinessType.DELETE)
|
@Log(title = "员工异动(入职/离职/转正)", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{changeIds}")
|
@DeleteMapping("/{changeIds}")
|
||||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||||
@PathVariable Long[] changeIds) {
|
@PathVariable Long[] changeIds) {
|
||||||
@@ -116,4 +116,14 @@ public class WmsEmployeeChangeController extends BaseController {
|
|||||||
public R<Void> leave(@Validated(AddGroup.class) @RequestBody WmsEmployeeChangeBo bo) {
|
public R<Void> leave(@Validated(AddGroup.class) @RequestBody WmsEmployeeChangeBo bo) {
|
||||||
return toAjax(iWmsEmployeeChangeService.employeeLeave(bo));
|
return toAjax(iWmsEmployeeChangeService.employeeLeave(bo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 员工转正
|
||||||
|
*/
|
||||||
|
@Log(title = "员工转正", businessType = BusinessType.INSERT)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping("/regular")
|
||||||
|
public R<Void> regular(@Validated(AddGroup.class) @RequestBody WmsEmployeeChangeBo bo) {
|
||||||
|
return toAjax(iWmsEmployeeChangeService.employeeRegular(bo));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,15 +31,15 @@ public class WmsEmployeeChange extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private Long infoId;
|
private Long infoId;
|
||||||
/**
|
/**
|
||||||
* 异动类型:0=入职,1=离职
|
* 异动类型:0=入职,1=离职,2=转正
|
||||||
*/
|
*/
|
||||||
private Integer changeType;
|
private Integer changeType;
|
||||||
/**
|
/**
|
||||||
* 异动时间(入职/离职时间)
|
* 异动时间(入职/离职/转正时间)
|
||||||
*/
|
*/
|
||||||
private Date changeTime;
|
private Date changeTime;
|
||||||
/**
|
/**
|
||||||
* 异动原因(离职必填,入职可选)
|
* 异动原因(离职必填,入职/转正可选)
|
||||||
*/
|
*/
|
||||||
private String changeReason;
|
private String changeReason;
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class WmsEmployeeChangeBo extends BaseEntity {
|
|||||||
private Long infoId;
|
private Long infoId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 异动类型:0=入职,1=离职
|
* 异动类型:0=入职,1=离职,2=转正
|
||||||
*/
|
*/
|
||||||
private Integer changeType;
|
private Integer changeType;
|
||||||
|
|
||||||
|
|||||||
@@ -36,23 +36,23 @@ public class WmsEmployeeChangeVo {
|
|||||||
private Long infoId;
|
private Long infoId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 异动类型:0=入职,1=离职
|
* 异动类型:0=入职,1=离职,2=转正
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "异动类型:0=入职,1=离职")
|
@ExcelProperty(value = "异动类型:0=入职,1=离职,2=转正")
|
||||||
private Integer changeType;
|
private Integer changeType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 异动时间(入职/离职时间)
|
* 异动时间(入职/离职/转正时间)
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "异动时间", converter = ExcelDictConvert.class)
|
@ExcelProperty(value = "异动时间", converter = ExcelDictConvert.class)
|
||||||
@ExcelDictFormat(readConverterExp = "入=职/离职时间")
|
@ExcelDictFormat(readConverterExp = "入=职/离职/转正时间")
|
||||||
private Date changeTime;
|
private Date changeTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 异动原因(离职必填,入职可选)
|
* 异动原因(离职必填,入职/转正可选)
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "异动原因", converter = ExcelDictConvert.class)
|
@ExcelProperty(value = "异动原因", converter = ExcelDictConvert.class)
|
||||||
@ExcelDictFormat(readConverterExp = "离=职必填,入职可选")
|
@ExcelDictFormat(readConverterExp = "离=职必填,入职/转正可选")
|
||||||
private String changeReason;
|
private String changeReason;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import java.util.Collection;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 员工异动(入职/离职)Service接口
|
* 员工异动(入职/离职/转正)Service接口
|
||||||
*
|
*
|
||||||
* @author klp
|
* @author klp
|
||||||
* @date 2026-03-14
|
* @date 2026-03-14
|
||||||
@@ -18,32 +18,32 @@ import java.util.List;
|
|||||||
public interface IWmsEmployeeChangeService {
|
public interface IWmsEmployeeChangeService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询员工异动(入职/离职)
|
* 查询员工异动(入职/离职/转正)
|
||||||
*/
|
*/
|
||||||
WmsEmployeeChangeVo queryById(Long changeId);
|
WmsEmployeeChangeVo queryById(Long changeId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询员工异动(入职/离职)列表
|
* 查询员工异动(入职/离职/转正)列表
|
||||||
*/
|
*/
|
||||||
TableDataInfo<WmsEmployeeChangeVo> queryPageList(WmsEmployeeChangeBo bo, PageQuery pageQuery);
|
TableDataInfo<WmsEmployeeChangeVo> queryPageList(WmsEmployeeChangeBo bo, PageQuery pageQuery);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询员工异动(入职/离职)列表
|
* 查询员工异动(入职/离职/转正)列表
|
||||||
*/
|
*/
|
||||||
List<WmsEmployeeChangeVo> queryList(WmsEmployeeChangeBo bo);
|
List<WmsEmployeeChangeVo> queryList(WmsEmployeeChangeBo bo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增员工异动(入职/离职)
|
* 新增员工异动(入职/离职/转正)
|
||||||
*/
|
*/
|
||||||
Boolean insertByBo(WmsEmployeeChangeBo bo);
|
Boolean insertByBo(WmsEmployeeChangeBo bo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改员工异动(入职/离职)
|
* 修改员工异动(入职/离职/转正)
|
||||||
*/
|
*/
|
||||||
Boolean updateByBo(WmsEmployeeChangeBo bo);
|
Boolean updateByBo(WmsEmployeeChangeBo bo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验并批量删除员工异动(入职/离职)信息
|
* 校验并批量删除员工异动(入职/离职/转正)信息
|
||||||
*/
|
*/
|
||||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||||
|
|
||||||
@@ -56,4 +56,9 @@ public interface IWmsEmployeeChangeService {
|
|||||||
* 员工离职
|
* 员工离职
|
||||||
*/
|
*/
|
||||||
Boolean employeeLeave(WmsEmployeeChangeBo bo);
|
Boolean employeeLeave(WmsEmployeeChangeBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 员工转正
|
||||||
|
*/
|
||||||
|
Boolean employeeRegular(WmsEmployeeChangeBo bo);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import java.util.Map;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 员工异动(入职/离职)Service业务层处理
|
* 员工异动(入职/离职/转正)Service业务层处理
|
||||||
*
|
*
|
||||||
* @author klp
|
* @author klp
|
||||||
* @date 2026-03-14
|
* @date 2026-03-14
|
||||||
@@ -36,7 +36,7 @@ public class WmsEmployeeChangeServiceImpl implements IWmsEmployeeChangeService {
|
|||||||
private final WmsEmployeeInfoMapper wmsEmployeeInfoMapper;
|
private final WmsEmployeeInfoMapper wmsEmployeeInfoMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询员工异动(入职/离职)
|
* 查询员工异动(入职/离职/转正)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public WmsEmployeeChangeVo queryById(Long changeId){
|
public WmsEmployeeChangeVo queryById(Long changeId){
|
||||||
@@ -49,7 +49,7 @@ public class WmsEmployeeChangeServiceImpl implements IWmsEmployeeChangeService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询员工异动(入职/离职)列表
|
* 查询员工异动(入职/离职/转正)列表
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public TableDataInfo<WmsEmployeeChangeVo> queryPageList(WmsEmployeeChangeBo bo, PageQuery pageQuery) {
|
public TableDataInfo<WmsEmployeeChangeVo> queryPageList(WmsEmployeeChangeBo bo, PageQuery pageQuery) {
|
||||||
@@ -63,7 +63,7 @@ public class WmsEmployeeChangeServiceImpl implements IWmsEmployeeChangeService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询员工异动(入职/离职)列表
|
* 查询员工异动(入职/离职/转正)列表
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<WmsEmployeeChangeVo> queryList(WmsEmployeeChangeBo bo) {
|
public List<WmsEmployeeChangeVo> queryList(WmsEmployeeChangeBo bo) {
|
||||||
@@ -89,7 +89,7 @@ public class WmsEmployeeChangeServiceImpl implements IWmsEmployeeChangeService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增员工异动(入职/离职)
|
* 新增员工异动(入职/离职/转正)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Boolean insertByBo(WmsEmployeeChangeBo bo) {
|
public Boolean insertByBo(WmsEmployeeChangeBo bo) {
|
||||||
@@ -103,7 +103,7 @@ public class WmsEmployeeChangeServiceImpl implements IWmsEmployeeChangeService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改员工异动(入职/离职)
|
* 修改员工异动(入职/离职/转正)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Boolean updateByBo(WmsEmployeeChangeBo bo) {
|
public Boolean updateByBo(WmsEmployeeChangeBo bo) {
|
||||||
@@ -120,7 +120,7 @@ public class WmsEmployeeChangeServiceImpl implements IWmsEmployeeChangeService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除员工异动(入职/离职)
|
* 批量删除员工异动(入职/离职/转正)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||||
@@ -205,4 +205,43 @@ public class WmsEmployeeChangeServiceImpl implements IWmsEmployeeChangeService {
|
|||||||
change.setRemark(bo.getRemark());
|
change.setRemark(bo.getRemark());
|
||||||
return baseMapper.insert(change) > 0;
|
return baseMapper.insert(change) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 员工转正
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public Boolean employeeRegular(WmsEmployeeChangeBo bo) {
|
||||||
|
if (bo.getInfoId() == null) {
|
||||||
|
throw new RuntimeException("员工ID不能为空");
|
||||||
|
}
|
||||||
|
WmsEmployeeInfo employee = wmsEmployeeInfoMapper.selectById(bo.getInfoId());
|
||||||
|
if (employee == null) {
|
||||||
|
throw new RuntimeException("员工不存在");
|
||||||
|
}
|
||||||
|
if (employee.getIsLeave() != null && employee.getIsLeave() == 1) {
|
||||||
|
throw new RuntimeException("员工已离职,无法转正");
|
||||||
|
}
|
||||||
|
if (employee.getIsRegular() != null && employee.getIsRegular() == 1) {
|
||||||
|
throw new RuntimeException("员工已转正");
|
||||||
|
}
|
||||||
|
|
||||||
|
employee.setIsRegular(1);
|
||||||
|
employee.setRegularTime(bo.getChangeTime());
|
||||||
|
boolean flag = wmsEmployeeInfoMapper.updateById(employee) > 0;
|
||||||
|
if (!flag) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
WmsEmployeeChange change = new WmsEmployeeChange();
|
||||||
|
change.setInfoId(bo.getInfoId());
|
||||||
|
change.setChangeType(2);
|
||||||
|
change.setChangeTime(bo.getChangeTime());
|
||||||
|
change.setChangeReason(bo.getChangeReason());
|
||||||
|
change.setChangeHandler(bo.getChangeHandler());
|
||||||
|
change.setAttachment(bo.getAttachment());
|
||||||
|
change.setCreateBy(bo.getCreateBy());
|
||||||
|
change.setRemark(bo.getRemark());
|
||||||
|
return baseMapper.insert(change) > 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user