|
|
|
|
@ -1,5 +1,6 @@ |
|
|
|
|
package org.springblade.desk.jobtransfer.service.impl; |
|
|
|
|
|
|
|
|
|
import com.alibaba.csp.sentinel.util.StringUtil; |
|
|
|
|
import jakarta.annotation.Resource; |
|
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
|
import org.springblade.desk.basic.pojo.entity.RelTeamSetUser; |
|
|
|
|
@ -20,6 +21,8 @@ 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.UserCache; |
|
|
|
|
import org.springblade.system.feign.IUserClient; |
|
|
|
|
import org.springblade.system.pojo.entity.User; |
|
|
|
|
import org.springblade.system.pojo.entity.UserInfo; |
|
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
@ -45,6 +48,8 @@ public class PostHandleServiceImpl extends BaseServiceImpl<PostHandleMapper, Pos |
|
|
|
|
private IEquipmentMaintenanceService equipmentMaintenanceService; |
|
|
|
|
private IRelTeamSetUserService relTeamSetUserService; |
|
|
|
|
@Resource |
|
|
|
|
private IUserClient userClient; |
|
|
|
|
@Resource |
|
|
|
|
public void setICultivateDetailService(ICultivateDetailService iCultivateDetailService) { |
|
|
|
|
this.iCultivateDetailService = iCultivateDetailService; |
|
|
|
|
} |
|
|
|
|
@ -251,6 +256,13 @@ public class PostHandleServiceImpl extends BaseServiceImpl<PostHandleMapper, Pos |
|
|
|
|
if (!saved) { |
|
|
|
|
return R.fail("操作失败"); |
|
|
|
|
} |
|
|
|
|
//更新用户表中的手机号、岗位、部门、生日
|
|
|
|
|
List<User> userList = list.stream() |
|
|
|
|
.filter(Objects::nonNull) // 过滤空对象
|
|
|
|
|
.map(this::convertToUser) // 转换实体
|
|
|
|
|
.filter(Objects::nonNull) // 过滤转换失败的对象
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
userClient.updateUser(userList); |
|
|
|
|
try { |
|
|
|
|
createPlan(list); // 确保此方法中的异常能传播出来
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
@ -260,6 +272,38 @@ public class PostHandleServiceImpl extends BaseServiceImpl<PostHandleMapper, Pos |
|
|
|
|
return R.status(saved); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 将 PostHandleEntity 转换为 User |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public User convertToUser(PostHandleEntity postHandle) { |
|
|
|
|
User user = new User(); |
|
|
|
|
if (null == postHandle.getUserId()) { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
user.setId(postHandle.getUserId()); |
|
|
|
|
// 设置手机号
|
|
|
|
|
if (StringUtil.isNotBlank(postHandle.getMobile())) { |
|
|
|
|
user.setPhone(postHandle.getMobile()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 设置岗位
|
|
|
|
|
if (StringUtil.isNotBlank(postHandle.getStation())) { |
|
|
|
|
// 这里可能需要根据岗位名称获取岗位ID
|
|
|
|
|
user.setPostId(postHandle.getStation()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 设置部门
|
|
|
|
|
if (postHandle.getDeptId() != null) { |
|
|
|
|
user.setDeptId(String.valueOf(postHandle.getDeptId())); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 设置生日
|
|
|
|
|
if (postHandle.getDataBirth() != null) { |
|
|
|
|
user.setBirthday(postHandle.getDataBirth()); |
|
|
|
|
} |
|
|
|
|
return user; |
|
|
|
|
} |
|
|
|
|
@Override |
|
|
|
|
public R jobTransfer(JobTransferSave jobTransferSave) { |
|
|
|
|
if (!(PostHandleStatusEnum.JOB_TRANSFER_TRAINED.getCode().shortValue() == jobTransferSave.getPhStatus())) { |
|
|
|
|
@ -317,11 +361,17 @@ public class PostHandleServiceImpl extends BaseServiceImpl<PostHandleMapper, Pos |
|
|
|
|
entity.setName(userByCode.getUser().getRealName()); |
|
|
|
|
entity.setDeptId(Long.valueOf(userByCode.getUser().getDeptId())); |
|
|
|
|
//技能等级
|
|
|
|
|
entity.setSkill(SkillEnum.of(excel.getSkillName()).getCode().shortValue()); |
|
|
|
|
if (-1 != SkillEnum.of(excel.getSkillName()).getCode().shortValue()) { |
|
|
|
|
entity.setSkill(SkillEnum.of(excel.getSkillName()).getCode().shortValue()); |
|
|
|
|
} |
|
|
|
|
//婚姻状态
|
|
|
|
|
entity.setMarriage(MarriageEnum.of(excel.getMarriageName()).getCode().toString()); |
|
|
|
|
//性别
|
|
|
|
|
entity.setGender(GenderEnum.of(excel.getGender()).getCode().toString()); |
|
|
|
|
entity.setGender(userByCode.getUser().getSex().toString()); |
|
|
|
|
//手机
|
|
|
|
|
entity.setMobile(userByCode.getUser().getPhone()); |
|
|
|
|
//岗位
|
|
|
|
|
entity.setStation(userByCode.getUser().getPostId()); |
|
|
|
|
// 如果是正式工状态为正常
|
|
|
|
|
if (entity.getStaffType() == StaffTypeEnum.FORMAL.getCode().shortValue()) { |
|
|
|
|
entity.setPhStatus(PostHandleStatusEnum.NORMALITY.getCode().shortValue()); |
|
|
|
|
|