yangys
2024-03-28 23a939ed820ee32f9a4309f9c81b7bab5a566f30
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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;
    }
}