|
|
|
|
@ -3,7 +3,9 @@ package org.springblade.desk.jobTransfer.service.impl; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
|
|
|
|
import jakarta.annotation.Resource; |
|
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
|
import org.springblade.desk.jobTransfer.pojo.entity.CertificateMaintenanceEntity; |
|
|
|
|
import org.springblade.desk.jobTransfer.pojo.entity.CultivateDetailEntity; |
|
|
|
|
import org.springblade.desk.jobTransfer.pojo.entity.EquipmentMaintenanceEntity; |
|
|
|
|
import org.springblade.desk.jobTransfer.pojo.entity.PostHandleEntity; |
|
|
|
|
import org.springblade.desk.jobTransfer.pojo.enums.*; |
|
|
|
|
import org.springblade.desk.jobTransfer.pojo.excel.PostHandleExcel; |
|
|
|
|
@ -11,7 +13,9 @@ import org.springblade.desk.jobTransfer.pojo.excel.PostHandleImport; |
|
|
|
|
import org.springblade.desk.jobTransfer.pojo.request.PostHandleQuery; |
|
|
|
|
import org.springblade.desk.jobTransfer.pojo.vo.PostHandleVO; |
|
|
|
|
import org.springblade.desk.jobTransfer.mapper.PostHandleMapper; |
|
|
|
|
import org.springblade.desk.jobTransfer.service.ICertificateMaintenanceService; |
|
|
|
|
import org.springblade.desk.jobTransfer.service.ICultivateDetailService; |
|
|
|
|
import org.springblade.desk.jobTransfer.service.IEquipmentMaintenanceService; |
|
|
|
|
import org.springblade.desk.jobTransfer.service.IPostHandleService; |
|
|
|
|
import org.springblade.system.cache.SysCache; |
|
|
|
|
import org.springblade.system.cache.UserCache; |
|
|
|
|
@ -40,6 +44,12 @@ public class PostHandleServiceImpl extends BaseServiceImpl<PostHandleMapper, Pos |
|
|
|
|
@Resource |
|
|
|
|
private ICultivateDetailService iCultivateDetailService; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private ICertificateMaintenanceService certificateMaintenanceService; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private IEquipmentMaintenanceService equipmentMaintenanceService; |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public IPage<PostHandleVO> selectPostHandlePage(IPage<PostHandleVO> page, PostHandleQuery postHandleQuery) { |
|
|
|
|
// return page.setRecords(baseMapper.selectPostHandlePage(page, postHandle));
|
|
|
|
|
@ -63,12 +73,12 @@ public class PostHandleServiceImpl extends BaseServiceImpl<PostHandleMapper, Pos |
|
|
|
|
// 1. 验证阶段:查看匹配的数据数量,如数量和id不同,则失败
|
|
|
|
|
Long matchedCount = this.lambdaQuery() |
|
|
|
|
.in(PostHandleEntity::getId, ids) |
|
|
|
|
// .eq(PostHandleEntity::getPhStatus, PostHandleStatusEnum.of(""))
|
|
|
|
|
.eq(PostHandleEntity::getPhStatus, PostHandleStatusEnum.IN_PRACTICE_TRAINED.getCode().shortValue()) |
|
|
|
|
.eq(PostHandleEntity::getStaffType, StaffTypeEnum.FIELD_WORK.getCode()) |
|
|
|
|
.eq(PostHandleEntity::getIsDeleted, 0) |
|
|
|
|
.count(); |
|
|
|
|
if (matchedCount < ids.size()) { |
|
|
|
|
return R.fail("请选择实习工进行转正操作"); |
|
|
|
|
return R.fail("请在实习培训完成后操作"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//更新阶段
|
|
|
|
|
@ -231,6 +241,43 @@ public class PostHandleServiceImpl extends BaseServiceImpl<PostHandleMapper, Pos |
|
|
|
|
return R.status(saved); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public R jobTransfer(PostHandleEntity postHandleEntity) { |
|
|
|
|
if (!(PostHandleStatusEnum.JOB_TRANSFER_TRAINED.getCode().shortValue() == postHandleEntity.getPhStatus())) { |
|
|
|
|
return R.fail("请在转岗培训完成后操作"); |
|
|
|
|
} |
|
|
|
|
postHandleEntity.setPhStatus(PostHandleStatusEnum.NORMALITY.getCode().shortValue()); |
|
|
|
|
postHandleEntity.setToNewJob(new Date()); |
|
|
|
|
return R.status(this.updateById(postHandleEntity)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
public R depart(PostHandleEntity postHandleEntity) { |
|
|
|
|
//1.离职修改状态
|
|
|
|
|
if (!(PostHandleStatusEnum.LAID_OFF_TRAINED.getCode().shortValue() == postHandleEntity.getPhStatus())) { |
|
|
|
|
return R.fail("请在下岗培训完成后操作"); |
|
|
|
|
} |
|
|
|
|
postHandleEntity.setPhStatus(PostHandleStatusEnum.DEPART.getCode().shortValue()); |
|
|
|
|
postHandleEntity.setToNewJob(new Date()); |
|
|
|
|
boolean updateP = this.updateById(postHandleEntity); |
|
|
|
|
//2.离职后需把证书维护的状态置为离职
|
|
|
|
|
boolean updateC = certificateMaintenanceService.lambdaUpdate() |
|
|
|
|
.eq(CertificateMaintenanceEntity::getPhId, postHandleEntity.getId()) |
|
|
|
|
.set(CertificateMaintenanceEntity::getMaintenanceStatus, MaintenanceStatusEnum.DEPART.getCode().shortValue()) |
|
|
|
|
.update(); |
|
|
|
|
//3.离职后需把设备维护的状态置为离职
|
|
|
|
|
boolean updateE = equipmentMaintenanceService.lambdaUpdate() |
|
|
|
|
.eq(EquipmentMaintenanceEntity::getPhId, postHandleEntity.getId()) |
|
|
|
|
.set(EquipmentMaintenanceEntity::getMaintenanceStatus, MaintenanceStatusEnum.DEPART.getCode().shortValue()) |
|
|
|
|
.update(); |
|
|
|
|
if (updateP && updateC && updateE) { |
|
|
|
|
return R.status(updateE); |
|
|
|
|
} else { |
|
|
|
|
return R.fail("操作失败"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 转换单个对象 |
|
|
|
|
*/ |
|
|
|
|
|