package com.qianwen.smartman.modules.cps.wrapper; import java.util.List; import java.util.Objects; import java.util.Optional; import com.qianwen.smartman.common.cache.SysCache; import com.qianwen.smartman.common.cache.UserCache; import com.qianwen.core.mp.support.BaseEntityWrapper; import com.qianwen.core.tool.utils.Func; import com.qianwen.core.tool.utils.SpringUtil; import com.qianwen.smartman.modules.cps.convert.EmployeeConvert; import com.qianwen.smartman.modules.cps.dto.EmployeeDTO; import com.qianwen.smartman.modules.cps.entity.CommonGroup; import com.qianwen.smartman.modules.cps.service.ICommonGroupService; import com.qianwen.smartman.modules.cps.vo.EmployeeDetailVO; import com.qianwen.smartman.modules.system.entity.User; /* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/cps/wrapper/EmployeeWrapper.class */ public class EmployeeWrapper extends BaseEntityWrapper { public static EmployeeWrapper build() { return new EmployeeWrapper(); } public EmployeeDetailVO entityVO(EmployeeDTO entity) { EmployeeDetailVO employeeDetailVO = (EmployeeDetailVO) Objects.requireNonNull(EmployeeConvert.INSTANCE.convertToDetail(entity)); List deptName = SysCache.getDeptNames(entity.getDeptId()); List postName = SysCache.getPostNames(entity.getPostId()); List roleName = SysCache.getRoleNames(entity.getRoleId()); User user = UserCache.getUser(Long.valueOf(Func.toLong(entity.getUserId()))); employeeDetailVO.setDeptName(Func.join(deptName)); employeeDetailVO.setPostName(Func.join(postName)); employeeDetailVO.setAccount(Func.isNotEmpty(user) ? user.getAccount() : null); employeeDetailVO.setRoleName(Func.join(roleName)); employeeDetailVO.setOrganizationName( Optional.ofNullable(employeeDetailVO.getOrganizationId()) .map(orgid -> { ICommonGroupService groupService = SpringUtil.getBean(ICommonGroupService.class); return groupService.getById(orgid); //return null; }) .map(CommonGroup::getName) .orElse(null) ); /* Optional ofNullable = Optional.ofNullable(employeeDetailVO.getOrganizationId()); ICommonGroupService iCommonGroupService = (ICommonGroupService) SpringUtil.getBean(ICommonGroupService.class); iCommonGroupService.getClass(); employeeDetailVO.setOrganizationName((String) ofNullable.map((v1) -> { return r2.getById(v1); }).map((v0) -> { return v0.getName(); }).orElse(null)); */ return employeeDetailVO; } }