薪资明细模板导出根据项目类型设置单元格格式

This commit is contained in:
钱涛 2025-03-17 11:03:42 +08:00
parent 3fb29b2c3d
commit a29f8b3da9
1 changed files with 16 additions and 4 deletions

View File

@ -13,6 +13,7 @@ import com.engine.salary.entity.salarysob.po.SalarySobPO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.UserStatusEnum;
import com.engine.salary.enums.datacollection.UseEmployeeTypeEnum;
import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum;
import com.engine.salary.enums.salarysob.SalaryEmployeeStatusEnum;
import com.engine.salary.mapper.salaryacct.SalaryAcctEmployeeMapper;
import com.engine.salary.report.common.constant.SalaryConstant;
@ -248,12 +249,23 @@ public class SalaryStatisticsEmployeeServiceImpl extends Service implements Sala
List<SalaryAcctRecordPO> salaryAcctRecordPOS = getSalaryAcctRecordService(user).listAll();
Map<Long, Integer> salaryAcctRecordMap = SalaryEntityUtil.convert2Map(salaryAcctRecordPOS, SalaryAcctRecordPO::getId, SalaryAcctRecordPO::getAcctTimes);
List<SalaryItemPO> salaryItemPOList = getSalaryItemService(user).listAll();
Map<Long, String> itemDataTypeMap = SalaryEntityUtil.convert2Map(salaryItemPOList, SalaryItemPO::getId, SalaryItemPO::getDataType);
Map<Long, List<SalaryAcctResultPO>> acctResultValueList = SalaryEntityUtil.group2Map(salaryStatisticsEmployeeDetailResult.getSalaryAcctResultValueList(), SalaryAcctResultPO::getSalaryAcctEmpId);
Map<Long, Map<String, String>> acctResultValueMap = new HashMap<>();
Map<Long, Map<String, Object>> acctResultValueMap = new HashMap<>();
acctResultValueList.forEach((k, v) -> {
Map<String, String> map = new HashMap();
Map<String, Object> map = new HashMap();
v.forEach(l -> {
map.put(l.getSalaryItemId() + "", l.getResultValue());
String dataType = itemDataTypeMap.getOrDefault(l.getSalaryItemId(), "string");
SalaryDataTypeEnum typeEnum = SalaryDataTypeEnum.parseByValue(dataType);
String resultValue = l.getResultValue();
if (typeEnum == SalaryDataTypeEnum.NUMBER && NumberUtil.isNumber(resultValue)) {
map.put(l.getSalaryItemId() + "", Double.valueOf(resultValue));
} else {
map.put(l.getSalaryItemId() + "", resultValue);
}
});
acctResultValueMap.put(k, map);
});
@ -265,7 +277,7 @@ public class SalaryStatisticsEmployeeServiceImpl extends Service implements Sala
Map<String, Object> map;
for (SalaryAcctEmployeePO se : salaryStatisticsEmployeeDetailResult.getSalaryAcctEmployeeList()) {
map = Maps.newHashMap();
Map<String, String> resultValueMap = Optional.ofNullable(acctResultValueMap.get(se.getId())).orElse(Maps.newHashMap());
Map<String, Object> resultValueMap = Optional.ofNullable(acctResultValueMap.get(se.getId())).orElse(Maps.newHashMap());
Map<String, Object> finalMap = map;
resultValueMap.forEach((k, v) -> {
finalMap.put(k + SalaryConstant.DYNAMIC_SUFFIX, v);