Merge branch 'release/3.0.0.2403.01' into custom/艾志工业

This commit is contained in:
Harryxzy 2024-03-12 13:28:28 +08:00
commit 46626b4c25
10 changed files with 135 additions and 39 deletions

View File

@ -0,0 +1,20 @@
package com.engine.salary.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* 国际化标识
* <p>Copyright: Copyright (c) 2024</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface I18n {
}

View File

@ -1,5 +1,6 @@
package com.engine.salary.entity.datacollection;
import com.engine.salary.annotation.I18n;
import com.engine.salary.annotation.SalaryFormulaVar;
import lombok.AllArgsConstructor;
import lombok.Builder;
@ -33,16 +34,19 @@ public class DataCollectionEmployee {
//姓名
@SalaryFormulaVar(defaultLabel = "姓名", labelId = 85429, dataType = "string")
@I18n
private String username;
//部门
@SalaryFormulaVar(defaultLabel = "部门", labelId = 86185, dataType = "string")
@I18n
private String departmentName;
@SalaryFormulaVar(defaultLabel = "部门ID", labelId = 86185, dataType = "string")
private Long departmentId;
//分部名
@SalaryFormulaVar(defaultLabel = "分部", labelId = 82465, dataType = "string")
@I18n
private String subcompanyName;
@SalaryFormulaVar(defaultLabel = "分部ID", labelId = 82465, dataType = "string")
private Long subcompanyid;
@ -55,6 +59,7 @@ public class DataCollectionEmployee {
//岗位
@SalaryFormulaVar(defaultLabel = "岗位", labelId = 90633, dataType = "string")
@I18n
private String jobtitleName;
@SalaryFormulaVar(defaultLabel = "岗位ID", labelId = 90633, dataType = "string")
private Long jobtitleId;

View File

@ -1,5 +1,6 @@
package com.engine.salary.entity.hrm;
import com.engine.salary.annotation.I18n;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@ -24,6 +25,7 @@ public class PositionInfo {
/**
* 名称
*/
@I18n
private String name;

View File

@ -1,5 +1,6 @@
package com.engine.salary.entity.hrm;
import com.engine.salary.annotation.I18n;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@ -24,5 +25,6 @@ public class SubCompanyInfo {
/**
* 名称
*/
@I18n
private String name;
}

View File

@ -1,6 +1,7 @@
package com.engine.salary.entity.salaryarchive.dto;
import com.cloudstore.eccom.pc.table.WeaTableType;
import com.engine.salary.annotation.I18n;
import com.engine.salary.annotation.SalaryTable;
import com.engine.salary.annotation.SalaryTableOperate;
import com.engine.salary.annotation.TableTitle;
@ -42,6 +43,7 @@ public class SalaryArchiveListDTO {
* 姓名
*/
@TableTitle(title = "姓名", dataIndex = "username", key = "username")
@I18n
private String username;
/**
@ -55,12 +57,14 @@ public class SalaryArchiveListDTO {
* 分部
*/
@TableTitle(title = "分部", dataIndex = "subcompanyName", key = "subcompanyName")
@I18n
private String subcompanyName;
/**
* 部门
*/
@TableTitle(title = "部门", dataIndex = "departmentName", key = "departmentName")
@I18n
private String departmentName;
private Long departmentId;
/**

View File

@ -2,7 +2,8 @@ package com.engine.salary.service.impl;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.biz.*;
import com.engine.salary.biz.SalaryArchiveBiz;
import com.engine.salary.biz.SalaryArchiveItemBiz;
import com.engine.salary.config.SalaryElogConfig;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.constant.SalaryItemConstant;
@ -24,7 +25,6 @@ import com.engine.salary.enums.datacollection.UseEmployeeTypeEnum;
import com.engine.salary.enums.salaryarchive.SalaryArchiveImportTypeEnum;
import com.engine.salary.enums.salaryarchive.SalaryArchiveListTypeEnum;
import com.engine.salary.enums.salaryarchive.SalaryArchiveStatusEnum;
import com.engine.salary.mapper.archive.SalaryArchiveMapper;
import com.engine.salary.service.*;
import com.engine.salary.sys.entity.po.SalarySysConfPO;
import com.engine.salary.sys.service.SalarySysConfService;
@ -32,7 +32,6 @@ import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.SalaryLoggerUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.excel.ExcelComment;
import com.engine.salary.util.excel.ExcelParseHelper;
import com.engine.salary.util.excel.ExcelSupport;
@ -43,8 +42,6 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.util.IOUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import weaver.file.ImageFileManager;
import weaver.general.Util;
import weaver.hrm.User;
@ -63,12 +60,6 @@ import static com.engine.salary.util.excel.ExcelSupport.EXCEL_TYPE_XLSX;
*/
public class SalaryArchiveExcelServiceImpl extends Service implements SalaryArchiveExcelService {
private static final Logger log = LoggerFactory.getLogger(SalaryArchiveExcelServiceImpl.class);
private SalaryArchiveMapper getSalaryArchiveMapper() {
return MapperProxyFactory.getProxy(SalaryArchiveMapper.class);
}
private SalaryArchiveItemService salaryArchiveItemService(User user) {
return ServiceUtil.getService(SalaryArchiveItemServiceImpl.class, user);
}
@ -101,9 +92,6 @@ public class SalaryArchiveExcelServiceImpl extends Service implements SalaryArch
private SalaryArchiveBiz salaryArchiveMapper = new SalaryArchiveBiz();
private SalaryArchiveItemBiz salaryArchiveItemMapper = new SalaryArchiveItemBiz();
private SalaryArchiveTaxAgentBiz salaryArchiveTaxAgentMapper = new SalaryArchiveTaxAgentBiz();
private SalaryArchiveDimissionBiz salaryArchiveDimissionMapper = new SalaryArchiveDimissionBiz();
private SalaryItemBiz salaryItemMapper = new SalaryItemBiz();
// private SalaryArchiveSobService salaryArchiveSobService;
//
@ -331,14 +319,7 @@ public class SalaryArchiveExcelServiceImpl extends Service implements SalaryArch
rows.add(header);
// 获取所有个税扣缴义务人
Collection<TaxAgentPO> taxAgentList = getTaxAgentService(user).listAll();
Collection<SalaryArchiveListDTO> salaryArchives = new ArrayList<>();
if (queryParam.isExtSalaryArchiveList()) {
//非系统人员档案
salaryArchives = getSalaryArchiveMapper().listExtSalaryArchive(queryParam);
} else {
salaryArchives = getSalaryArchiveMapper().list(queryParam);
}
Collection<SalaryArchiveListDTO> salaryArchives = salaryArchiveService(user).getSalaryArchiveList(queryParam);
long employeeId = user.getUID();
if (getTaxAgentService(user).isNeedAuth(employeeId)) {
@ -897,7 +878,7 @@ public class SalaryArchiveExcelServiceImpl extends Service implements SalaryArch
// 修改薪资档案
if (CollectionUtils.isNotEmpty(salaryArchiveUpdates)) {
// 查询更新前档案信息
List<SalaryArchivePO> oldArchive = getSalaryArchiveMapper().listSome(SalaryArchivePO.builder().ids(salaryArchiveUpdates.stream().map(SalaryArchivePO::getId).collect(Collectors.toList())).build());
List<SalaryArchivePO> oldArchive = salaryArchiveService(user).listSome(SalaryArchivePO.builder().ids(salaryArchiveUpdates.stream().map(SalaryArchivePO::getId).collect(Collectors.toList())).build());
Map<Long, SalaryArchivePO> oldArchiveMap = SalaryEntityUtil.convert2Map(oldArchive, SalaryArchivePO::getId);
// 薪资档案
salaryArchiveMapper.batchUpdate(salaryArchiveUpdates);

View File

@ -182,7 +182,9 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
if (Objects.nonNull(queryParam.getPayEndDateEndDateStr())) {
queryParam.setPayEndDateEndDate(SalaryDateUtil.stringToDate(queryParam.getPayEndDateEndDateStr()));
}
return getSalaryArchiveMapper().list(queryParam);
List<SalaryArchiveListDTO> list = getSalaryArchiveMapper().list(queryParam);
return SalaryI18nUtil.i18nList(list);
}
@Override

View File

@ -29,6 +29,7 @@ import com.engine.salary.service.SalarySobExtRangeService;
import com.engine.salary.service.SalarySobRangeService;
import com.engine.salary.sys.entity.po.SalarySysConfPO;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.db.IdGenerator;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
@ -96,6 +97,7 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee
result.addAll(employBiz.listAll());
result.addAll(getExtEmpService(user).listEmployee());
}
SalaryI18nUtil.i18nList(result);
return result;
}
@ -105,6 +107,7 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee
if (openExtEmp) {
result.addAll(getExtEmpService(user).listAllForReport());
}
SalaryI18nUtil.i18nList(result);
return result;
}
@ -150,7 +153,7 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee
includeSalaryEmployees.addAll(extEmps);
}
SalaryI18nUtil.i18nList(includeSalaryEmployees);
return includeSalaryEmployees;
}
@ -163,6 +166,7 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee
if (openExtEmp) {
employeeList.addAll(getExtEmpService(user).getEmployeeByIds(ids));
}
SalaryI18nUtil.i18nList(employeeList);
return employeeList;
}
@ -176,18 +180,20 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee
result.addAll(getExtEmpService(user).getEmployeeByIds(ids));
}
result.addAll(employBiz.getEmployeeByIdsAll(ids));
SalaryI18nUtil.i18nList(result);
return result;
}
@Override
public DataCollectionEmployee getEmployeeById(Long employeeId) {
if (openExtEmp) {
DataCollectionEmployee employeeById = getExtEmpService(user).getEmployeeById(employeeId);
if (Objects.nonNull(employeeById)) {
return employeeById;
DataCollectionEmployee employee = getExtEmpService(user).getEmployeeById(employeeId);
if (Objects.nonNull(employee)) {
return SalaryI18nUtil.i18n(employee);
}
}
return employBiz.getEmployeeById(employeeId);
DataCollectionEmployee employee = employBiz.getEmployeeById(employeeId);
return SalaryI18nUtil.i18n(employee);
}
@Override
@ -203,8 +209,7 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee
employeeList.addAll(getExtEmpService(user).getEmployeeByIds(longs));
}
}
return employeeList;
return SalaryI18nUtil.i18nList(employeeList);
}
@ -219,7 +224,7 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee
.filter(e -> UserStatusEnum.getNormalStatus().contains(e.getStatus()))
.collect(Collectors.toList());
return employeeSameIds;
return SalaryI18nUtil.i18nList(employeeSameIds);
}
@Override
@ -242,7 +247,7 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee
.collect(Collectors.toList());
}
return employees;
return SalaryI18nUtil.i18nList(employees);
}
@ -265,12 +270,12 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee
@Override
public List<SubCompanyInfo> getSubCompanyInfoList(List<Long> subDepartmentIds) {
return employBiz.getSubCompanyInfoList(subDepartmentIds);
return SalaryI18nUtil.i18nList(employBiz.getSubCompanyInfoList(subDepartmentIds));
}
@Override
public List<PositionInfo> listPositionInfo(List<Long> positionIds) {
return employBiz.listPositionInfo(positionIds);
return SalaryI18nUtil.i18nList(employBiz.listPositionInfo(positionIds));
}
@Override
@ -279,7 +284,7 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee
if (openExtEmp) {
result.addAll(getExtEmpService(user).listEmployee());
}
return result;
return SalaryI18nUtil.i18nList(result);
}
@Override
@ -288,7 +293,7 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee
if (openExtEmp) {
result.addAll(getExtEmpService(user).listByParams(includeQueryParams));
}
return result;
return SalaryI18nUtil.i18nList(result);
}
/**
@ -332,7 +337,7 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee
.forEach(e -> e.setExtendData(extendData));
}
}
return employees;
return SalaryI18nUtil.i18nList(employees);
}
@Override

View File

@ -1,5 +1,18 @@
package com.engine.salary.util;
import com.engine.salary.annotation.I18n;
import com.engine.salary.exception.SalaryRunTimeException;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.NotNull;
import weaver.general.Util;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
* 多语言工具类
* <p>Copyright: Copyright (c) 2022</p>
@ -10,6 +23,68 @@ package com.engine.salary.util;
**/
public class SalaryI18nUtil {
public static <T> T i18n(T data) {
if (data == null ) {
return data;
}
try {
List<Field> fieldList = getFields(data.getClass());
if (CollectionUtils.isNotEmpty(fieldList)) {
for (Field field : fieldList) {
field.setAccessible(true);
String fieldValue = (String) field.get(data);
if (StringUtils.isNotBlank(fieldValue)) {
String encryptValue = Util.formatMultiLang(fieldValue);
field.set(data, encryptValue);
}
}
}
return data;
} catch (Exception e) {
throw new SalaryRunTimeException("国际化解析异常");
}
}
public static <T> List<T> i18nList(List<T> dataList) {
if (CollectionUtils.isEmpty(dataList) ) {
return dataList;
}
try {
List<Field> fieldList = getFields(dataList.get(0).getClass());
if (CollectionUtils.isNotEmpty(fieldList)) {
for (T data : dataList) {
for (Field field : fieldList) {
field.setAccessible(true);
String fieldValue = (String) field.get(data);
if (StringUtils.isNotBlank(fieldValue)) {
String encryptValue = Util.formatMultiLang(fieldValue);
field.set(data, encryptValue);
}
}
}
}
return dataList;
} catch (Exception e) {
throw new SalaryRunTimeException("国际化批量解析异常");
}
}
@NotNull
private static <T> List<Field> getFields(Class<T> clazz) {
List<Class<?>> allClasses = new ArrayList<Class<?>>();
for (Class<?> superClass = clazz; superClass != null; superClass = superClass.getSuperclass()) {
if (superClass != Object.class) {
allClasses.add(superClass);
}
}
return allClasses.stream()
.map(Class::getDeclaredFields)
.flatMap(Arrays::stream)
.filter(field -> field.isAnnotationPresent(I18n.class)).collect(Collectors.toList());
}
/**
* 获取多语言信息
*

View File

@ -463,7 +463,7 @@ public class SalaryArchiveWrapper extends Service {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(109712, "列表类型必传"));
} else {
// 定薪列表导入有调薪导入和初始化导入
if (queryParam.getListType().equals(SalaryArchiveListTypeEnum.FIXED.getValue())) {
if (queryParam.getListType().equals(SalaryArchiveListTypeEnum.FIXED)) {
Optional<SalaryArchiveImportTypeEnum> optional = Arrays.stream(SalaryArchiveImportTypeEnum.values())
.filter(e -> StringUtils.isNotEmpty(queryParam.getImportType()) && e.getValue().equals(queryParam.getImportType())).findFirst();
if (!optional.isPresent()) {