package com.qianwen.smartman.modules.cps.wrapper;
|
|
import java.util.List;
|
import java.util.Objects;
|
import com.qianwen.smartman.common.cache.DictCache;
|
import com.qianwen.smartman.common.cache.SysCache;
|
import com.qianwen.smartman.common.cache.UserCache;
|
import com.qianwen.smartman.common.constant.DateConstant;
|
import com.qianwen.smartman.common.enums.DictEnum;
|
import com.qianwen.core.mp.support.BaseEntityWrapper;
|
import com.qianwen.core.tool.utils.DateUtil;
|
import com.qianwen.core.tool.utils.Func;
|
import com.qianwen.smartman.modules.cps.convert.EmployeeConvert;
|
import com.qianwen.smartman.modules.cps.dto.EmployeeDTO;
|
import com.qianwen.smartman.modules.cps.excel.EmployeeExcel;
|
import com.qianwen.smartman.modules.system.entity.User;
|
|
/* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/cps/wrapper/EmployeeExcelWrapper.class */
|
public class EmployeeExcelWrapper extends BaseEntityWrapper<EmployeeDTO, EmployeeExcel> {
|
public static EmployeeExcelWrapper build() {
|
return new EmployeeExcelWrapper();
|
}
|
|
public EmployeeExcel entityVO(EmployeeDTO entity) {
|
EmployeeExcel employeeExcel = (EmployeeExcel) Objects.requireNonNull(EmployeeConvert.INSTANCE.convert(entity));
|
List<String> deptName = SysCache.getDeptNames(entity.getDeptId());
|
List<String> postName = SysCache.getPostNames(entity.getPostId());
|
User user = UserCache.getUser(Long.valueOf(Func.toLong(entity.getUserId())));
|
if (Func.isNotEmpty(entity.getHireDate())) {
|
employeeExcel.setHireDate(DateUtil.format(entity.getHireDate(), DateConstant.PATTERN_DATE));
|
}
|
employeeExcel.setDeptName(Func.join(deptName));
|
employeeExcel.setPostName(Func.join(postName));
|
employeeExcel.setAccount(Func.isNotEmpty(user) ? user.getAccount() : null);
|
employeeExcel.setStatusName(DictCache.getValue(DictEnum.EMPLOYEE_STATUS, entity.getStatus()));
|
return employeeExcel;
|
}
|
}
|