薪酬系统-多语言,文字转义优化以及导出excel列宽设置优化

This commit is contained in:
sy 2023-07-06 16:52:08 +08:00
parent 65da8930a1
commit 68bcfeb2c6
14 changed files with 70 additions and 34 deletions

View File

@ -81,7 +81,7 @@ public class SISchemeBiz extends Service {
.insuranceId(item.getId())
.insuranceName(item.getInsuranceName())
// .paymentScope(e.getDefaultLabel())
.paymentScope(SalaryI18nUtil.getI18nLabel(user.getLanguage(),e.getLabelId(), e.getDefaultLabel()))
.paymentScope(SalaryI18nUtil.getI18nLabel(user.getLanguage(),e.getLabelId(), e.getDefaultLabel()).replace(" ", ""))
.rententionRule(String.valueOf(RententionRuleEnum.ROUND.getValue()))
.cycleSetting("000000000000")
.paymentCycle("0")
@ -139,7 +139,7 @@ public class SISchemeBiz extends Service {
insuranceSchemeDetailDTO.setInsuranceName(item.getInsuranceName());
insuranceSchemeDetailDTO.setRententionRule(String.valueOf(insuranceSchemeDetailPO.getRententionRule()));
// insuranceSchemeDetailDTO.setPaymentScope(e.getDefaultLabel());
insuranceSchemeDetailDTO.setPaymentScope(SalaryI18nUtil.getI18nLabel(user.getLanguage(),e.getLabelId(), e.getDefaultLabel()));
insuranceSchemeDetailDTO.setPaymentScope(SalaryI18nUtil.getI18nLabel(user.getLanguage(),e.getLabelId(), e.getDefaultLabel()).replace(" ", ""));
}
insuranceSchemeDetailDTO.setPaymentScopeValue(e.getValue());

View File

@ -47,7 +47,7 @@ public class SICategoryGetFormCmd extends AbstractCommonCommand<Map<String, Obje
input.setFieldcol(12); //条件输入框所占宽度默认值18
input.setViewAttr(3); // 编辑权限 1只读2可编辑 3必填 默认2
input.setLength(10); // 设置输入长度
input.setLabel("福利名称"); //设置文本值 这个将覆盖多语言标签的值
input.setLabel(SalaryI18nUtil.getI18nLabel(user.getLanguage(),0, "福利名称")); //设置文本值 这个将覆盖多语言标签的值
input.setRules("required"); //设置字段填入规则
items.put("insuranceName",input);
@ -69,7 +69,7 @@ public class SICategoryGetFormCmd extends AbstractCommonCommand<Map<String, Obje
SearchConditionItem checkbox = conditionFactory.createCondition(ConditionType.CHECKBOX,502327,"paymentScope");
List<SearchConditionOption> checkOptions = new ArrayList <>();
checkOptions.add(new SearchConditionOption("SCOPE_COMPANY",SalaryI18nUtil.getI18nLabel(user.getLanguage(),1851, "公司")));
checkOptions.add(new SearchConditionOption("SCOPE_COMPANY",SalaryI18nUtil.getI18nLabel(user.getLanguage(),388108, "公司")));
checkOptions.add(new SearchConditionOption("SCOPE_PERSON", SalaryI18nUtil.getI18nLabel(user.getLanguage(),500201, "个人")));
checkbox.setColSpan(2);
checkbox.setFieldcol(12);
@ -77,7 +77,7 @@ public class SICategoryGetFormCmd extends AbstractCommonCommand<Map<String, Obje
checkbox.setViewAttr(3);
checkbox.setIsQuickSearch(false);
checkbox.setOptions(checkOptions);
checkbox.setLabel("缴纳对象");
checkbox.setLabel(SalaryI18nUtil.getI18nLabel(user.getLanguage(),543169, "缴纳对象"));
checkbox.setRules("required");
items.put("paymentScope",checkbox);

View File

@ -68,6 +68,10 @@ public enum TargetTypeEnum implements BaseEnum<Integer> {
}).collect(Collectors.toList());
}
public static List<TargetTypeEnum> getEffectiveList() {
return Arrays.stream(TargetTypeEnum.values()).filter(v -> v != ALL).collect(Collectors.toList());
}
public static TargetTypeEnum parseByValue(Integer value) {
for (TargetTypeEnum targetTypeEnum : TargetTypeEnum.values()) {
if (Objects.equals(targetTypeEnum.getValue(), value)) {

View File

@ -8,7 +8,7 @@ import java.util.Arrays;
import java.util.Objects;
public enum PaymentScopeEnum implements BaseEnum<Integer> {
SCOPE_COMPANY(1, SalaryI18nUtil.getI18nLabel(1851, "公司"), 1851),
SCOPE_COMPANY(1, SalaryI18nUtil.getI18nLabel(388108, "公司"), 388108),
SCOPE_PERSON(2, SalaryI18nUtil.getI18nLabel(500201, "个人"), 500201);
private Integer value;

View File

@ -11,7 +11,7 @@ import com.engine.salary.util.SalaryI18nUtil;
*/
public enum UndertakerEnum implements BaseEnum<Integer> {
SCOPE_COMPANY(1, SalaryI18nUtil.getI18nLabel(1851, "公司"), 1851),
SCOPE_COMPANY(1, SalaryI18nUtil.getI18nLabel(388108, "公司"), 388108),
SCOPE_PERSON(2, SalaryI18nUtil.getI18nLabel(500201, "个人"), 500201);
private Integer value;

View File

@ -3,7 +3,7 @@ package com.engine.salary.report.enums;
import com.engine.salary.util.SalaryI18nUtil;
public enum PaymentScopeEnum {
SCOPE_COMPANY(1, SalaryI18nUtil.getI18nLabel(1851, "公司"), 1851),
SCOPE_COMPANY(1, SalaryI18nUtil.getI18nLabel(388108, "公司"), 388108),
SCOPE_PERSON(2, SalaryI18nUtil.getI18nLabel(500201, "个人"), 500201);
private Integer value;

View File

@ -2525,11 +2525,11 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
List<SearchConditionGroup> addGroups = new ArrayList<>();
getPaymentGroup(socialPerJson, SalaryI18nUtil.getI18nLabel(user.getLanguage(),500201, "个人"), SalaryI18nUtil.getI18nLabel(user.getLanguage(),538967, "社保"), dataMap, addGroups);
getPaymentGroup(socialComJson, SalaryI18nUtil.getI18nLabel(user.getLanguage(),1851, "公司"), SalaryI18nUtil.getI18nLabel(user.getLanguage(),538967, "社保"), dataMap, addGroups);
getPaymentGroup(socialComJson, SalaryI18nUtil.getI18nLabel(user.getLanguage(),388108, "公司"), SalaryI18nUtil.getI18nLabel(user.getLanguage(),538967, "社保"), dataMap, addGroups);
getPaymentGroup(fundPerJson, SalaryI18nUtil.getI18nLabel(user.getLanguage(),500201, "个人"), SalaryI18nUtil.getI18nLabel(user.getLanguage(),538969, "公积金"), dataMap, addGroups);
getPaymentGroup(fundComJson, SalaryI18nUtil.getI18nLabel(user.getLanguage(),1851, "公司"), SalaryI18nUtil.getI18nLabel(user.getLanguage(),538969, "公积金"), dataMap, addGroups);
getPaymentGroup(fundComJson, SalaryI18nUtil.getI18nLabel(user.getLanguage(),388108, "公司"), SalaryI18nUtil.getI18nLabel(user.getLanguage(),538969, "公积金"), dataMap, addGroups);
getPaymentGroup(otherPerJson, SalaryI18nUtil.getI18nLabel(user.getLanguage(),500201, "个人"), SalaryI18nUtil.getI18nLabel(user.getLanguage(),542460, "其他福利"), dataMap, addGroups);
getPaymentGroup(otherComJson, SalaryI18nUtil.getI18nLabel(user.getLanguage(),1851, "公司"), SalaryI18nUtil.getI18nLabel(user.getLanguage(),542460, "其他福利"), dataMap, addGroups);
getPaymentGroup(otherComJson, SalaryI18nUtil.getI18nLabel(user.getLanguage(),388108, "公司"), SalaryI18nUtil.getI18nLabel(user.getLanguage(),542460, "其他福利"), dataMap, addGroups);
Map<String, Object> resultMap = new HashMap<>();
// resultMap.put("data", dataMap);
@ -2556,9 +2556,9 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
perList.add(map);
}
} else if (group.getTitle().contains(SalaryI18nUtil.getI18nLabel(user.getLanguage(),1851, "公司"))) {
} else if (group.getTitle().contains(SalaryI18nUtil.getI18nLabel(user.getLanguage(),388108, "公司"))) {
map.put("title", group.getTitle());
map.put("paymentScope", SalaryI18nUtil.getI18nLabel(user.getLanguage(),1851, "公司"));
map.put("paymentScope", SalaryI18nUtil.getI18nLabel(user.getLanguage(),388108, "公司"));
map.put("insuranceName", item.getLabel());
map.put("insuranceId", insuranceId);
map.put("insuranceValue", dataMap.get(domkey[0]));

View File

@ -233,7 +233,7 @@ public class SIRepairServiceImpl extends Service implements SIRepairService {
comMap.put("insuranceId", k);
comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
comMap.put("paymentScope", SalaryI18nUtil.getI18nLabel(user.getLanguage(),1851, "公司"));
comMap.put("paymentScope", SalaryI18nUtil.getI18nLabel(user.getLanguage(),388108, "公司"));
resultList.add(perMap);
resultList.add(comMap);
@ -258,7 +258,7 @@ public class SIRepairServiceImpl extends Service implements SIRepairService {
comMap.put("insuranceId", k);
comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
comMap.put("paymentScope", SalaryI18nUtil.getI18nLabel(user.getLanguage(),1851, "公司"));
comMap.put("paymentScope", SalaryI18nUtil.getI18nLabel(user.getLanguage(),388108, "公司"));
resultList.add(perMap);
resultList.add(comMap);
@ -283,7 +283,7 @@ public class SIRepairServiceImpl extends Service implements SIRepairService {
comMap.put("insuranceId", k);
comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
comMap.put("paymentScope", SalaryI18nUtil.getI18nLabel(user.getLanguage(),1851, "公司"));
comMap.put("paymentScope", SalaryI18nUtil.getI18nLabel(user.getLanguage(),388108, "公司"));
resultList.add(perMap);
resultList.add(comMap);
@ -311,7 +311,7 @@ public class SIRepairServiceImpl extends Service implements SIRepairService {
comMap.put("insuranceId", k);
comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
comMap.put("paymentScope", SalaryI18nUtil.getI18nLabel(user.getLanguage(),1851, "公司"));
comMap.put("paymentScope", SalaryI18nUtil.getI18nLabel(user.getLanguage(),388108, "公司"));
resultList.add(perMap);
resultList.add(comMap);
@ -342,7 +342,7 @@ public class SIRepairServiceImpl extends Service implements SIRepairService {
comMap.put("insuranceId", k);
comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
comMap.put("paymentScope", SalaryI18nUtil.getI18nLabel(user.getLanguage(),1851, "公司"));
comMap.put("paymentScope", SalaryI18nUtil.getI18nLabel(user.getLanguage(),388108, "公司"));
resultList.add(perMap);
resultList.add(comMap);
@ -374,7 +374,7 @@ public class SIRepairServiceImpl extends Service implements SIRepairService {
comMap.put("insuranceId", k);
comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
comMap.put("paymentScope", SalaryI18nUtil.getI18nLabel(user.getLanguage(),1851, "公司"));
comMap.put("paymentScope", SalaryI18nUtil.getI18nLabel(user.getLanguage(),388108, "公司"));
resultList.add(perMap);
resultList.add(comMap);
@ -405,7 +405,7 @@ public class SIRepairServiceImpl extends Service implements SIRepairService {
comMap.put("insuranceId", k);
comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
comMap.put("paymentScope", SalaryI18nUtil.getI18nLabel(user.getLanguage(),1851, "公司"));
comMap.put("paymentScope", SalaryI18nUtil.getI18nLabel(user.getLanguage(),388108, "公司"));
resultList.add(perMap);
resultList.add(comMap);
@ -433,7 +433,7 @@ public class SIRepairServiceImpl extends Service implements SIRepairService {
comMap.put("insuranceId", k);
comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
comMap.put("paymentScope", SalaryI18nUtil.getI18nLabel(user.getLanguage(),1851, "公司"));
comMap.put("paymentScope", SalaryI18nUtil.getI18nLabel(user.getLanguage(),388108, "公司"));
resultList.add(perMap);
resultList.add(comMap);
@ -461,7 +461,7 @@ public class SIRepairServiceImpl extends Service implements SIRepairService {
comMap.put("insuranceId", k);
comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k)));
comMap.put("paymentScope", SalaryI18nUtil.getI18nLabel(user.getLanguage(),1851, "公司"));
comMap.put("paymentScope", SalaryI18nUtil.getI18nLabel(user.getLanguage(),388108, "公司"));
resultList.add(perMap);
resultList.add(comMap);

View File

@ -245,7 +245,12 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM
PageInfo<TaxAgentManageRangeListDTO> dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), TaxAgentManageRangeListDTO.class);
// 查询人员状态
// List<HrmStatus> hrmStatusList = hrmCommonHrmStatusService.list();
List<HrmStatus> hrmStatusList = UserStatusEnum.getHrmStatusList();
// List<HrmStatus> hrmStatusList = UserStatusEnum.getHrmStatusList();
List<UserStatusEnum> userStatusEnumList = UserStatusEnum.getEffectiveList();
List<HrmStatus> hrmStatusList = new ArrayList<>();
userStatusEnumList.forEach(f -> {
hrmStatusList.add(HrmStatus.builder().id(f.getValue().toString()).name(SalaryI18nUtil.getI18nLabel(user.getLanguage(),f.getLabelId(), f.getDefaultLabel())).build());
});
// 薪资账套的人员范围po转换成列表dto
List<TaxAgentManageRangeListDTO> taxAgentManageRangeList = TaxAgentBO.convert2ListDTO(taxAgentManageRanges, employeeComInfos, departmentComInfos, subDepartmentComInfos, positionComInfos, hrmStatusList, user);
// 根据对象名称过滤

View File

@ -28,12 +28,12 @@ public class ICategoryTransMethod {
public static String getPaymentcopeTypeName(String type, User user) {
switch (type) {
case "1":
return SalaryI18nUtil.getI18nLabel(user.getLanguage(),1851, "公司");
return SalaryI18nUtil.getI18nLabel(user.getLanguage(),388108, "公司");
case "2":
return SalaryI18nUtil.getI18nLabel(user.getLanguage(),500201, "个人");
case "1,2":
case "2,1":
return SalaryI18nUtil.getI18nLabel(user.getLanguage(),1851, "公司") + "," + SalaryI18nUtil.getI18nLabel(user.getLanguage(),500201, "个人");
return SalaryI18nUtil.getI18nLabel(user.getLanguage(),388108, "公司") + "," + SalaryI18nUtil.getI18nLabel(user.getLanguage(),500201, "个人");
default:
return "";
}

View File

@ -58,12 +58,14 @@ public class SalaryEnumUtil {
/**
* 获取枚举下拉列表
* @param enumName 枚举路径列如com.engine.salary.enums.salaryarchive.SalaryArchiveStatusEnum
* @param infoMap enumName 枚举路径列如com.engine.salary.enums.salaryarchive.SalaryArchiveStatusEnum
* @return
*/
public static List<Map<String, Object>> enumSelectList(String enumName) {
public static List<Map<String, Object>> enumSelectList(Map infoMap) {
try {
String enumName = infoMap.get("enumClass").toString();
User user = (User) infoMap.get("user");
List<Map<String, Object>> keyValueList = new ArrayList<Map<String, Object>>();
Class cls = Class.forName(enumName);
@ -75,7 +77,10 @@ public class SalaryEnumUtil {
for (BaseEnum enumMessage : enums) {
Map<String, Object> hashMap = new HashMap<String, Object>();
hashMap.put("value", enumMessage.getValue());
hashMap.put("defaultLabel", enumMessage.getDefaultLabel());
// hashMap.put("defaultLabel", enumMessage.getDefaultLabel());
hashMap.put("defaultLabel", SalaryI18nUtil.getI18nLabel(user.getLanguage(), enumMessage.getLabelId(), enumMessage.getDefaultLabel()).equals("null ")
? enumMessage.getDefaultLabel()
: SalaryI18nUtil.getI18nLabel(user.getLanguage(), enumMessage.getLabelId(), enumMessage.getDefaultLabel()));
hashMap.put("labelId", enumMessage.getLabelId());
keyValueList.add(hashMap);

View File

@ -109,7 +109,8 @@ public class ExcelUtilPlus {
//遍历设置列宽
List<Object> header = rowList.get(0);
for (int i = 0; i < header.size(); i++) {
sheet.setColumnWidth(i,Math.max(12, header.get(i).toString().length()*4)*256);
// sheet.setColumnWidth(i,Math.max(12, header.get(i).toString().length()*4)*256);
sheet.setColumnWidth(i,Math.min(80, Math.max(12, getStrlength(header.get(i).toString())*4))*256);
}
for (int rowIndex = 0; rowIndex < rowList.size(); rowIndex++) {
@ -193,7 +194,8 @@ public class ExcelUtilPlus {
//遍历设置列宽
List<Object> header = rowList.get(0);
for (int i = 0; i < header.size(); i++) {
sheet.setColumnWidth(i,Math.max(12, header.get(i).toString().length()*4)*256);
// sheet.setColumnWidth(i,Math.max(12, header.get(i).toString().length()*4)*256);
sheet.setColumnWidth(i,Math.min(80, Math.max(12, getStrlength(header.get(i).toString())*4))*256);
}
for (int rowIndex = 0; rowIndex < rowList.size(); rowIndex++) {
@ -298,7 +300,8 @@ public class ExcelUtilPlus {
//遍历设置列宽
List<Object> header = rowList.get(0);
for (int i = 0; i < header.size(); i++) {
sheet.setColumnWidth(i,Math.max(12, header.get(i).toString().length()*4)*256);
// sheet.setColumnWidth(i,Math.max(12, header.get(i).toString().length()*4)*256);
sheet.setColumnWidth(i,Math.min(80, Math.max(12, getStrlength(header.get(i).toString())*4))*256);
}
for (int rowIndex = 0; rowIndex < rowList.size(); rowIndex++) {

View File

@ -16,6 +16,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -31,7 +32,11 @@ public class SalaryCommonController {
@Produces(MediaType.APPLICATION_JSON)
public String getSearchCondition(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "enumClass") String enumClass) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<String, List<Map<String, Object>>>(user).run(SalaryEnumUtil::enumSelectList, enumClass);
Map infoMap = new HashMap();
infoMap.put("enumClass", enumClass);
infoMap.put("user", user);
// return new ResponseResult<String, List<Map<String, Object>>>(user).run(SalaryEnumUtil::enumSelectList, enumClass);
return new ResponseResult<Map, List<Map<String, Object>>>(user).run(SalaryEnumUtil::enumSelectList, infoMap);
}

View File

@ -330,9 +330,23 @@ public class TaxAgentWrapper extends Service {
*/
public TaxAgentManageRangeFormDTO getRangeFrom() {
// 查询人员状态
List<HrmStatus> hrmStatusList = UserStatusEnum.getHrmStatusList();
// List<HrmStatus> hrmStatusList = UserStatusEnum.getHrmStatusList();
List<UserStatusEnum> userStatusEnumList = UserStatusEnum.getEffectiveList();
List<HrmStatus> hrmStatusList = new ArrayList<>();
userStatusEnumList.forEach(f -> {
hrmStatusList.add(HrmStatus.builder().id(f.getValue().toString()).name(SalaryI18nUtil.getI18nLabel(user.getLanguage(),f.getLabelId(), f.getDefaultLabel())).build());
});
//人员类型下拉列表
List<Map<String, Object>> selectList = TargetTypeEnum.getSelectList();
// List<Map<String, Object>> selectList = TargetTypeEnum.getSelectList();
List<TargetTypeEnum> targetTypeEnumList = TargetTypeEnum.getEffectiveList();
List<Map<String, Object>> selectList = new ArrayList<>();
targetTypeEnumList.forEach(f -> {
Map<String, Object> map = new HashMap<>();
map.put("id", f.name());
map.put("name", SalaryI18nUtil.getI18nLabel(user.getLanguage(),f.getLabelId(), f.getDefaultLabel()));
map.put("value", f.getValue());
selectList.add(map);
});
return TaxAgentManageRangeFormDTO.builder().employeeStatus(hrmStatusList).targetTypeList(selectList).build();
}