Merge branch 'release/2.14.4.2406.02' into custom/宁波精华

This commit is contained in:
Harryxzy 2024-06-20 15:22:09 +08:00
commit fbc3ab008a
37 changed files with 662 additions and 155 deletions

View File

@ -0,0 +1,9 @@
ALTER TABLE hrsa_salary_item ADD default_value varchar2(255) NULL;
/
ALTER TABLE hrsa_salary_sob_item ADD default_value varchar2(255) NULL;
/
ALTER TABLE hrsa_salary_sob_back_item ADD default_value varchar2(255) NULL;
/

View File

@ -0,0 +1,9 @@
ALTER TABLE hrsa_salary_item ADD default_value varchar2(255) NULL;
/
ALTER TABLE hrsa_salary_sob_item ADD default_value varchar2(255) NULL;
/
ALTER TABLE hrsa_salary_sob_back_item ADD default_value varchar2(255) NULL;
/

View File

@ -0,0 +1,9 @@
ALTER TABLE hrsa_salary_item ADD default_value varchar2(255) NULL;
/
ALTER TABLE hrsa_salary_sob_item ADD default_value varchar2(255) NULL;
/
ALTER TABLE hrsa_salary_sob_back_item ADD default_value varchar2(255) NULL;
/

View File

@ -0,0 +1,3 @@
alter table hrsa_salary_item add default_value varchar(255);
alter table hrsa_salary_sob_item add default_value varchar(255);
alter table hrsa_salary_sob_back_item add default_value varchar(255);

View File

@ -0,0 +1,6 @@
ALTER TABLE hrsa_salary_item ADD default_value varchar2(255) NULL
/
ALTER TABLE hrsa_salary_sob_item ADD default_value varchar2(255) NULL
/
ALTER TABLE hrsa_salary_sob_back_item ADD default_value varchar2(255) NULL
/

View File

@ -0,0 +1,3 @@
alter table hrsa_salary_item add default_value VARCHAR(255);
alter table hrsa_salary_sob_item add default_value VARCHAR(255);
alter table hrsa_salary_sob_back_item add default_value VARCHAR(255);

View File

@ -0,0 +1,6 @@
alter table hrsa_salary_item add default_value varchar(255)
go
alter table hrsa_salary_sob_item add default_value varchar(255)
go
alter table hrsa_salary_sob_back_item add default_value varchar(255)
go

View File

@ -0,0 +1,9 @@
ALTER TABLE hrsa_salary_item ADD default_value varchar2(255) NULL;
/
ALTER TABLE hrsa_salary_sob_item ADD default_value varchar2(255) NULL;
/
ALTER TABLE hrsa_salary_sob_back_item ADD default_value varchar2(255) NULL;
/

View File

@ -176,6 +176,7 @@ public class SalaryItemBO {
.sortedIndex(salaryItemPO.getSortedIndex())
.description(salaryItemPO.getDescription())
.salaryItemType(salaryItemPO.getUseInEmployeeSalary() == 0 ? "薪资项目" : "档案字段")
.defaultValue(salaryItemPO.getDefaultValue())
.build();
}
).collect(Collectors.toList());
@ -207,7 +208,8 @@ public class SalaryItemBO {
.setTaxAgentIds(salaryItemPO.getTaxAgentIds())
.setSharedType(salaryItemPO.getSharedType())
.setSortedIndex(salaryItemPO.getSortedIndex())
.setWidth(salaryItemPO.getWidth());
.setWidth(salaryItemPO.getWidth())
.setDefaultValue(salaryItemPO.getDefaultValue());
}
/**
@ -288,6 +290,7 @@ public class SalaryItemBO {
.taxAgentIds(saveParam.getTaxAgentIds())
.sortedIndex(saveParam.getSortedIndex())
.width(saveParam.getWidth())
.defaultValue(saveParam.getDefaultValue())
.build();
// 开启了"薪资档案引用"取值方式固定为输入
// if (Objects.equals(saveParam.getUseInEmployeeSalary(), NumberUtils.INTEGER_ONE)) {

View File

@ -98,4 +98,7 @@ public class SalaryItemFormDTO {
// 宽度
private Integer width;
// 默认值
private String defaultValue;
}

View File

@ -113,6 +113,9 @@ public class SalaryItemSobListDTO {
//排序
private Integer sortedIndex;
// 默认值
private String defaultValue;
@SalaryTableColumn(text = "操作", width = "20%", column = "operate")
private String operate;

View File

@ -107,4 +107,9 @@ public class SalaryItemSaveParam {
* 宽度
*/
private Integer width;
/**
* 默认值
*/
private String defaultValue;
}

View File

@ -191,4 +191,10 @@ public class SalaryItemPO {
*/
@ElogTransform(name = "宽度")
private Integer width;
/**
* 默认值
*/
@ElogTransform(name = "默认值")
private String defaultValue;
}

View File

@ -144,6 +144,7 @@ public class SalarySobItemAggregateBO {
.canEdit(openFormulaForcedEditing || Objects.equals(salaryItemPO.getCanEdit(), 1))
.canDelete(openFormulaForcedEditing || salaryItemPO.getCanDelete() == null || Objects.equals(salaryItemPO.getCanDelete(), 1))
.width(salaryItemPO.getWidth())
.defaultValue(salaryItemPO.getDefaultValue())
.build());
}
}

View File

@ -112,4 +112,7 @@ public class SalarySobItemDTO {
// 显示宽度
private Integer width;
// 默认值
private String defaultValue;
}

View File

@ -83,4 +83,7 @@ public class SalarySobItemFormDTO {
// 薪资档案引用0薪资档案未引用1薪资档案引用
private Integer useInEmployeeSalary;
// 默认值
private String defaultValue;
}

View File

@ -78,6 +78,9 @@ public class SalarySobItemSaveParam {
private Boolean canDelete;
// 默认值
private String defaultValue;
/**
* 进位规则
*/

View File

@ -114,6 +114,11 @@ public class SalarySobBackItemPO{
@JsonIgnore
private Date updateTime;
/**
* 默认值
*/
private String defaultValue;
/**

View File

@ -119,6 +119,11 @@ public class SalarySobItemPO {
//该分类是否隐藏0不隐藏1隐藏
private Long itemHide;
/**
* 默认值
*/
private String defaultValue;
//in
Collection<Long> ids;
Collection<Long> salarySobIds;

View File

@ -52,7 +52,8 @@
t.tax_agent_ids,
t.sorted_index,
t.hide_default,
t.width
t.width,
t.default_value
</sql>
<!-- 查询全部 -->
@ -221,6 +222,9 @@
<if test="width != null">
width,
</if>
<if test="defaultValue != null">
default_value,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -295,6 +299,9 @@
<if test="width != null">
#{width},
</if>
<if test="defaultValue != null">
#{defaultValue},
</if>
</trim>
</insert>
@ -369,7 +376,12 @@
<if test="width != null">
width=#{width},
</if>
sorted_index=#{sortedIndex},
<if test="sortedIndex != null">
sorted_index=#{sortedIndex},
</if>
<if test="defaultValue != null">
default_value=#{defaultValue},
</if>
</set>
WHERE id = #{id} AND delete_type = 0
</update>

View File

@ -52,6 +52,7 @@
, t.delete_type
, t.create_time
, t.update_time
, t.default_value
</sql>

View File

@ -38,6 +38,7 @@
, t.rounding_mode
, t.pattern
, t.value_type
, t.default_value
, t.item_hide
</sql>
@ -223,9 +224,15 @@
<if test="valueType != null">
value_type=#{valueType},
</if>
<if test="defaultValue != null">
default_value=#{defaultValue},
</if>
<if test="itemHide != null">
item_hide=#{itemHide},
</if>
<if test="defaultValue != null">
default_value=#{defaultValue},
</if>
</set>
WHERE id = #{id} AND delete_type = 0
</update>
@ -272,7 +279,7 @@
<insert id="batchInsert">
INSERT INTO hrsa_salary_sob_item(salary_sob_id, salary_item_id, salary_sob_item_group_id, formula_id,
sorted_index, description, create_time, update_time, creator, delete_type, tenant_key,can_delete,rounding_mode,pattern,value_type,item_hide)
sorted_index, description, create_time, update_time, creator, delete_type, tenant_key,can_delete,rounding_mode,pattern,value_type,item_hide,default_value)
VALUES
<foreach collection="collection" item="item" separator=",">
(
@ -291,13 +298,14 @@
#{item.roundingMode},
#{item.pattern},
#{item.valueType},
#{item.itemHide}
#{item.itemHide},
#{item.defaultValue}
)
</foreach>
</insert>
<insert id="batchInsert" databaseId="oracle">
INSERT INTO hrsa_salary_sob_item( salary_sob_id, salary_item_id, salary_sob_item_group_id, formula_id,
sorted_index, description, create_time, update_time, creator, delete_type, tenant_key,can_delete,rounding_mode,pattern,value_type,item_hide)
sorted_index, description, create_time, update_time, creator, delete_type, tenant_key,can_delete,rounding_mode,pattern,value_type,item_hide,default_value)
<foreach collection="collection" item="item" separator="union all">
select
@ -316,14 +324,15 @@
#{item.roundingMode,jdbcType=INTEGER},
#{item.pattern,jdbcType=INTEGER},
#{item.valueType,jdbcType=INTEGER},
#{item.itemHide,jdbcType=DOUBLE}
#{item.itemHide,jdbcType=DOUBLE},
#{item.defaultValue,jdbcType=VARCHAR}
from dual
</foreach>
</insert>
<insert id="batchInsert" databaseId="sqlserver">
<foreach collection="collection" item="item" separator=";">
INSERT INTO hrsa_salary_sob_item( salary_sob_id, salary_item_id, salary_sob_item_group_id, formula_id,
sorted_index, description, create_time, update_time, creator, delete_type, tenant_key,can_delete,rounding_mode,pattern,value_type,item_hide)
sorted_index, description, create_time, update_time, creator, delete_type, tenant_key,can_delete,rounding_mode,pattern,value_type,item_hide,default_value)
VALUES
(
#{item.salarySobId},
@ -341,11 +350,13 @@
#{item.roundingMode},
#{item.pattern},
#{item.valueType},
#{item.itemHide}
#{item.itemHide},
#{item.defaultValue}
)
</foreach>
</insert>
<update id="deleteByGroupIds">
UPDATE hrsa_salary_sob_item
SET delete_type = 1

View File

@ -420,10 +420,28 @@ public class SalaryStatisticsReportWrapper extends Service {
}
});
List<Long> itemIds = salaryStatisticsItemList.stream().map(item -> item.getItemValue().split(",")).flatMap(Arrays::stream).filter(NumberUtils::isCreatable).map(Long::valueOf).collect(Collectors.toList());
List<SalaryItemPO> salaryItemPOList = getSalaryItemService(user).listByIds(itemIds);
List<String> numberItemIds = salaryItemPOList.stream().filter(item -> item.getDataType().equals(SalaryDataTypeEnum.NUMBER.getValue())).map(salaryItemPO -> salaryItemPO.getId().toString()).collect(Collectors.toList());
Map<String, SalaryStatisticsItemPO> salaryStatisticsItemMap = SalaryEntityUtil.convert2Map(salaryStatisticsItemList, statisticsItemPO -> statisticsItemPO.getId().toString());
for (Map<String, String> map : records) {
List<Object> row = Lists.newArrayListWithExpectedSize(records.size());
head.forEach(k -> {
row.add(map.getOrDefault(k, StringUtils.EMPTY));
// 获取是数值还是文本
if (k.contains(SalaryStatisticsReportBO.UD)) {
String[] split = k.split(SalaryStatisticsReportBO.UD);
String salaryItemId = split[0];
SalaryStatisticsItemPO salaryStatisticsItemPO = salaryStatisticsItemMap.get(salaryItemId);
if (salaryStatisticsItemPO != null) {
Optional<String> textItemOptional = Arrays.stream(salaryStatisticsItemPO.getItemValue().split(",")).filter(id -> !numberItemIds.contains(id)).findFirst();
row.add( (!textItemOptional.isPresent() && NumberUtils.isCreatable(map.getOrDefault(k, StringUtils.EMPTY).replace(",", ""))) ? new BigDecimal(map.get(k).replace(",", "")) : map.getOrDefault(k, StringUtils.EMPTY));
} else {
row.add(map.getOrDefault(k, StringUtils.EMPTY));
}
} else {
row.add(map.getOrDefault(k, StringUtils.EMPTY));
}
});
rows.add(row);
}

View File

@ -1,6 +1,7 @@
package com.engine.salary.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil;
import com.api.browser.bean.SearchConditionGroup;
import com.api.browser.bean.SearchConditionItem;
import com.api.browser.util.ConditionFactory;
@ -63,6 +64,7 @@ import weaver.general.Util;
import weaver.hrm.User;
import java.io.InputStream;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.time.*;
import java.util.*;
@ -1057,11 +1059,11 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
//获取操作按钮资源
List<List<String>> rowList = getExcelRowDetailList(isChief, queryParam);
List<List<Object>> rowList = getExcelRowDetailList(isChief, queryParam);
//获取excel
return ExcelUtil.genWorkbook(rowList, "累计专项附加扣除明细");
return ExcelUtil.genWorkbookWithDefaultPattern(rowList, "累计专项附加扣除明细", 2);
}
@ -1071,32 +1073,33 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
* @param param
* @return
*/
private List<List<String>> getExcelRowDetailList(boolean isChief, AddUpDeductionQueryParam param) {
private List<List<Object>> getExcelRowDetailList(boolean isChief, AddUpDeductionQueryParam param) {
long employeeId = user.getUID();
//excel标题
List<String> title = Arrays.asList("姓名", "申报月份", "个税扣缴义务人", "部门", "工号", "累计子女教育", "累计继续教育", "累计住房贷款利息", "累计住房租金", "累计赡养老人", "累计大病医疗", "累计婴幼儿照护");
List<Object> title = Arrays.asList("姓名", "申报月份", "个税扣缴义务人", "部门", "工号", "累计子女教育", "累计继续教育", "累计住房贷款利息", "累计住房租金", "累计赡养老人", "累计大病医疗", "累计婴幼儿照护");
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM");
//查询详细信息
List<AddUpDeductionRecordDTO> list = new AddUpDeductionBiz().recordList(param);
final List<List<String>> dataRowList = Optional.ofNullable(list)
final List<List<Object>> dataRowList = Optional.ofNullable(list)
.map(List::stream)
.map(operatorStream -> operatorStream.map(dto -> {
List<String> cellList = new ArrayList<>();
List<Object> cellList = new ArrayList<>();
cellList.add(Util.null2String(dto.getUsername()));
cellList.add(Util.null2String(dto.getDeclareMonth() == null ? "" : formatter.format(dto.getDeclareMonth())));
cellList.add(Util.null2String(dto.getTaxAgentName()));
cellList.add(Util.null2String(dto.getDepartmentName()));
cellList.add(Util.null2String(dto.getJobNum()));
cellList.add(Util.null2String(dto.getAddUpChildEducation()));
cellList.add(Util.null2String(dto.getAddUpContinuingEducation()));
cellList.add(Util.null2String(dto.getAddUpHousingLoanInterest()));
cellList.add(Util.null2String(dto.getAddUpHousingRent()));
cellList.add(Util.null2String(dto.getAddUpSupportElderly()));
cellList.add(Util.null2String(dto.getAddUpIllnessMedical()));
cellList.add(Util.null2String(dto.getAddUpInfantCare()));
cellList.add(NumberUtil.isNumber(dto.getAddUpChildEducation()) ? new BigDecimal(dto.getAddUpChildEducation()) : Util.null2String(dto.getAddUpChildEducation()));
cellList.add(NumberUtil.isNumber(dto.getAddUpContinuingEducation()) ? new BigDecimal(dto.getAddUpContinuingEducation()) :Util.null2String(dto.getAddUpContinuingEducation()));
cellList.add(NumberUtil.isNumber(dto.getAddUpHousingLoanInterest()) ? new BigDecimal(dto.getAddUpHousingLoanInterest()) :Util.null2String(dto.getAddUpHousingLoanInterest()));
cellList.add(NumberUtil.isNumber(dto.getAddUpHousingRent()) ? new BigDecimal(dto.getAddUpHousingRent()) :Util.null2String(dto.getAddUpHousingRent()));
cellList.add(NumberUtil.isNumber(dto.getAddUpSupportElderly()) ? new BigDecimal(dto.getAddUpSupportElderly()) :Util.null2String(dto.getAddUpSupportElderly()));
cellList.add(NumberUtil.isNumber(dto.getAddUpIllnessMedical()) ? new BigDecimal(dto.getAddUpIllnessMedical()) :Util.null2String(dto.getAddUpIllnessMedical()));
cellList.add(NumberUtil.isNumber(dto.getAddUpInfantCare()) ? new BigDecimal(dto.getAddUpInfantCare()) :Util.null2String(dto.getAddUpInfantCare()));
return cellList;
}).collect(Collectors.toList()))
.orElse(Collections.emptyList());
@ -1116,7 +1119,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
}
List<List<String>> rowList = new ArrayList<>();
List<List<Object>> rowList = new ArrayList<>();
rowList.add(title);
rowList.addAll(dataRowList);
return rowList;
@ -1204,7 +1207,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
SalaryElogConfig.addUpDeductionLoggerTemplate.write(loggerContext);
//获取excel
return ExcelUtil.genWorkbookV2(rowList, "累计专项附加扣除");
return ExcelUtil.genWorkbookV2WithDefaultPattern(rowList, "累计专项附加扣除", 2);
}
private List<List<Object>> getLists(AddUpDeductionQueryParam param) {
@ -1239,13 +1242,13 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
cellList.add(Util.null2String(dto.getJobNum()));
cellList.add(Util.null2String(dto.getIdNo()));
cellList.add(Util.null2String(dto.getHiredate()));
cellList.add(Util.null2String(dto.getAddUpChildEducation()));
cellList.add(Util.null2String(dto.getAddUpContinuingEducation()));
cellList.add(Util.null2String(dto.getAddUpHousingLoanInterest()));
cellList.add(Util.null2String(dto.getAddUpHousingRent()));
cellList.add(Util.null2String(dto.getAddUpSupportElderly()));
cellList.add(Util.null2String(dto.getAddUpIllnessMedical()));
cellList.add(Util.null2String(dto.getAddUpInfantCare()));
cellList.add(NumberUtil.isNumber(dto.getAddUpChildEducation()) ? new BigDecimal(dto.getAddUpChildEducation()) : Util.null2String(dto.getAddUpChildEducation()));
cellList.add(NumberUtil.isNumber(dto.getAddUpContinuingEducation()) ? new BigDecimal(dto.getAddUpContinuingEducation()) :Util.null2String(dto.getAddUpContinuingEducation()));
cellList.add(NumberUtil.isNumber(dto.getAddUpHousingLoanInterest()) ? new BigDecimal(dto.getAddUpHousingLoanInterest()) :Util.null2String(dto.getAddUpHousingLoanInterest()));
cellList.add(NumberUtil.isNumber(dto.getAddUpHousingRent()) ? new BigDecimal(dto.getAddUpHousingRent()) :Util.null2String(dto.getAddUpHousingRent()));
cellList.add(NumberUtil.isNumber(dto.getAddUpSupportElderly()) ? new BigDecimal(dto.getAddUpSupportElderly()) :Util.null2String(dto.getAddUpSupportElderly()));
cellList.add(NumberUtil.isNumber(dto.getAddUpIllnessMedical()) ? new BigDecimal(dto.getAddUpIllnessMedical()) :Util.null2String(dto.getAddUpIllnessMedical()));
cellList.add(NumberUtil.isNumber(dto.getAddUpInfantCare()) ? new BigDecimal(dto.getAddUpInfantCare()) :Util.null2String(dto.getAddUpInfantCare()));
return cellList;
}).collect(Collectors.toList()))
.orElse(Collections.emptyList());

View File

@ -1,5 +1,6 @@
package com.engine.salary.service.impl;
import cn.hutool.core.util.NumberUtil;
import com.api.browser.bean.SearchConditionGroup;
import com.api.browser.bean.SearchConditionItem;
import com.api.browser.util.ConditionFactory;
@ -57,6 +58,7 @@ import weaver.general.Util;
import weaver.hrm.User;
import java.io.InputStream;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.YearMonth;
@ -276,7 +278,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
SalaryElogConfig.addUpSituationLoggerTemplate.write(loggerContext);
// 获取excel
return ExcelUtil.genWorkbookV2(rowList, "累计情况");
return ExcelUtil.genWorkbookV2WithDefaultPattern(rowList, "累计情况", 2);
}
@ -320,24 +322,24 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
cellList.add(Util.null2String(dto.getJobNum()));
cellList.add(Util.null2String(dto.getIdNo()));
cellList.add(Util.null2String(dto.getHiredate()));
cellList.add(Util.null2String(dto.getAddUpIncome()));
cellList.add(Util.null2String(dto.getAddUpSubtraction()));
cellList.add(Util.null2String(dto.getAddUpSocialSecurityTotal()));
cellList.add(Util.null2String(dto.getAddUpAccumulationFundTotal()));
cellList.add(Util.null2String(dto.getAddUpChildEducation()));
cellList.add(Util.null2String(dto.getAddUpContinuingEducation()));
cellList.add(Util.null2String(dto.getAddUpHousingLoanInterest()));
cellList.add(Util.null2String(dto.getAddUpHousingRent()));
cellList.add(Util.null2String(dto.getAddUpSupportElderly()));
cellList.add(Util.null2String(dto.getAddUpIllnessMedical()));
cellList.add(Util.null2String(dto.getAddUpEnterpriseAndOther()));
cellList.add(Util.null2String(dto.getAddUpOtherDeduction()));
cellList.add(Util.null2String(dto.getAddUpTaxExemptIncome()));
cellList.add(Util.null2String(dto.getAddUpAllowedDonation()));
cellList.add(Util.null2String(dto.getAddUpTaxSavings()));
cellList.add(Util.null2String(dto.getAddUpAdvanceTax()));
cellList.add(Util.null2String(dto.getAddUpInfantCare()));
cellList.add(Util.null2String(dto.getAddUpPrivatePension()));
cellList.add(NumberUtil.isNumber(dto.getAddUpIncome()) ? new BigDecimal(dto.getAddUpIncome()) : Util.null2String(dto.getAddUpIncome()));
cellList.add(NumberUtil.isNumber(dto.getAddUpSubtraction()) ? new BigDecimal(dto.getAddUpSubtraction()) : Util.null2String(dto.getAddUpSubtraction()));
cellList.add(NumberUtil.isNumber(dto.getAddUpSocialSecurityTotal()) ? new BigDecimal(dto.getAddUpSocialSecurityTotal()) : Util.null2String(dto.getAddUpSocialSecurityTotal()));
cellList.add(NumberUtil.isNumber(dto.getAddUpAccumulationFundTotal()) ? new BigDecimal(dto.getAddUpAccumulationFundTotal()) : Util.null2String(dto.getAddUpAccumulationFundTotal()));
cellList.add(NumberUtil.isNumber(dto.getAddUpChildEducation()) ? new BigDecimal(dto.getAddUpChildEducation()) : Util.null2String(dto.getAddUpChildEducation()));
cellList.add(NumberUtil.isNumber(dto.getAddUpContinuingEducation()) ? new BigDecimal(dto.getAddUpContinuingEducation()) : Util.null2String(dto.getAddUpContinuingEducation()));
cellList.add(NumberUtil.isNumber(dto.getAddUpHousingLoanInterest()) ? new BigDecimal(dto.getAddUpHousingLoanInterest()) : Util.null2String(dto.getAddUpHousingLoanInterest()));
cellList.add(NumberUtil.isNumber(dto.getAddUpHousingRent()) ? new BigDecimal(dto.getAddUpHousingRent()) : Util.null2String(dto.getAddUpHousingRent()));
cellList.add(NumberUtil.isNumber(dto.getAddUpSupportElderly()) ? new BigDecimal(dto.getAddUpSupportElderly()) : Util.null2String(dto.getAddUpSupportElderly()));
cellList.add(NumberUtil.isNumber(dto.getAddUpIllnessMedical()) ? new BigDecimal(dto.getAddUpIllnessMedical()) : Util.null2String(dto.getAddUpIllnessMedical()));
cellList.add(NumberUtil.isNumber(dto.getAddUpEnterpriseAndOther()) ? new BigDecimal(dto.getAddUpEnterpriseAndOther()) : Util.null2String(dto.getAddUpEnterpriseAndOther()));
cellList.add(NumberUtil.isNumber(dto.getAddUpOtherDeduction()) ? new BigDecimal(dto.getAddUpOtherDeduction()) : Util.null2String(dto.getAddUpOtherDeduction()));
cellList.add(NumberUtil.isNumber(dto.getAddUpTaxExemptIncome()) ? new BigDecimal(dto.getAddUpTaxExemptIncome()) : Util.null2String(dto.getAddUpTaxExemptIncome()));
cellList.add(NumberUtil.isNumber(dto.getAddUpAllowedDonation()) ? new BigDecimal(dto.getAddUpAllowedDonation()) : Util.null2String(dto.getAddUpAllowedDonation()));
cellList.add(NumberUtil.isNumber(dto.getAddUpTaxSavings()) ? new BigDecimal(dto.getAddUpTaxSavings()) : Util.null2String(dto.getAddUpTaxSavings()));
cellList.add(NumberUtil.isNumber(dto.getAddUpAdvanceTax()) ? new BigDecimal(dto.getAddUpAdvanceTax()) : Util.null2String(dto.getAddUpAdvanceTax()));
cellList.add(NumberUtil.isNumber(dto.getAddUpInfantCare()) ? new BigDecimal(dto.getAddUpInfantCare()) : Util.null2String(dto.getAddUpInfantCare()));
cellList.add(NumberUtil.isNumber(dto.getAddUpPrivatePension()) ? new BigDecimal(dto.getAddUpPrivatePension()) : Util.null2String(dto.getAddUpPrivatePension()));
return cellList;
}).collect(Collectors.toList()))
.orElse(Collections.emptyList());
@ -354,10 +356,10 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
* @param param
* @return
*/
private List<List<String>> getExcelRowDetailList(AddUpSituationQueryParam param) {
private List<List<Object>> getExcelRowDetailList(AddUpSituationQueryParam param) {
long employeeId = user.getUID();
//excel标题
List<String> title = Arrays.asList("姓名", "税款所属期", "个税扣缴义务人", "部门", "手机号", "工号", "累计收入额", "累计减除费用", "累计社保个人合计",
List<Object> title = Arrays.asList("姓名", "税款所属期", "个税扣缴义务人", "部门", "手机号", "工号", "累计收入额", "累计减除费用", "累计社保个人合计",
"累计公积金个人合计", "累计子女教育", "累计继续教育", "累计住房贷款利息", "累计住房租金", "累计赡养老人", "累计大病医疗", "累计企业(职业)年金及其他福利",
"累计其他扣除", "累计免税收入", "累计准予扣除的捐赠额", "累计减免税额", "累计已预扣预缴税额", "累计婴幼儿照护", "累计个人养老金");
@ -373,39 +375,39 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
taxAgentIdsAsAdmin.contains(f.getTaxAgentId())
).collect(Collectors.toList());
}
final List<List<String>> dataRowList = Optional.ofNullable(list)
final List<List<Object>> dataRowList = Optional.ofNullable(list)
.map(List::stream)
.map(operatorStream -> operatorStream.map(dto -> {
List<String> cellList = new ArrayList<>();
List<Object> cellList = new ArrayList<>();
cellList.add(Util.null2String(dto.getUsername()));
cellList.add(Util.null2String(dto.getTaxYearMonth() == null ? "" : formatter.format(dto.getTaxYearMonth())));
cellList.add(Util.null2String(dto.getTaxAgentName()));
cellList.add(Util.null2String(dto.getDepartmentName()));
cellList.add(Util.null2String(dto.getMobile()));
cellList.add(Util.null2String(dto.getJobNum()));
cellList.add(Util.null2String(dto.getAddUpIncome()));
cellList.add(Util.null2String(dto.getAddUpSubtraction()));
cellList.add(Util.null2String(dto.getAddUpSocialSecurityTotal()));
cellList.add(Util.null2String(dto.getAddUpAccumulationFundTotal()));
cellList.add(Util.null2String(dto.getAddUpChildEducation()));
cellList.add(Util.null2String(dto.getAddUpContinuingEducation()));
cellList.add(Util.null2String(dto.getAddUpHousingLoanInterest()));
cellList.add(Util.null2String(dto.getAddUpHousingRent()));
cellList.add(Util.null2String(dto.getAddUpSupportElderly()));
cellList.add(Util.null2String(dto.getAddUpIllnessMedical()));
cellList.add(Util.null2String(dto.getAddUpEnterpriseAndOther()));
cellList.add(Util.null2String(dto.getAddUpOtherDeduction()));
cellList.add(Util.null2String(dto.getAddUpTaxExemptIncome()));
cellList.add(Util.null2String(dto.getAddUpAllowedDonation()));
cellList.add(Util.null2String(dto.getAddUpTaxSavings()));
cellList.add(Util.null2String(dto.getAddUpAdvanceTax()));
cellList.add(Util.null2String(dto.getAddUpInfantCare()));
cellList.add(Util.null2String(dto.getAddUpPrivatePension()));
cellList.add(NumberUtil.isNumber(dto.getAddUpIncome()) ? new BigDecimal(dto.getAddUpIncome()) : dto.getAddUpIncome());
cellList.add(NumberUtil.isNumber(dto.getAddUpSubtraction()) ? new BigDecimal(dto.getAddUpSubtraction()) : dto.getAddUpSubtraction());
cellList.add(NumberUtil.isNumber(dto.getAddUpSocialSecurityTotal()) ? new BigDecimal(dto.getAddUpSocialSecurityTotal()) : dto.getAddUpSocialSecurityTotal());
cellList.add(NumberUtil.isNumber(dto.getAddUpAccumulationFundTotal()) ? new BigDecimal(dto.getAddUpAccumulationFundTotal()) : dto.getAddUpAccumulationFundTotal());
cellList.add(NumberUtil.isNumber(dto.getAddUpChildEducation()) ? new BigDecimal(dto.getAddUpChildEducation()) : dto.getAddUpChildEducation());
cellList.add(NumberUtil.isNumber(dto.getAddUpContinuingEducation()) ? new BigDecimal(dto.getAddUpContinuingEducation()) : dto.getAddUpContinuingEducation());
cellList.add(NumberUtil.isNumber(dto.getAddUpHousingLoanInterest()) ? new BigDecimal(dto.getAddUpHousingLoanInterest()) : dto.getAddUpHousingLoanInterest());
cellList.add(NumberUtil.isNumber(dto.getAddUpHousingRent()) ? new BigDecimal(dto.getAddUpHousingRent()) : dto.getAddUpHousingRent());
cellList.add(NumberUtil.isNumber(dto.getAddUpSupportElderly()) ? new BigDecimal(dto.getAddUpSupportElderly()) : dto.getAddUpSupportElderly());
cellList.add(NumberUtil.isNumber(dto.getAddUpIllnessMedical()) ? new BigDecimal(dto.getAddUpIllnessMedical()) : dto.getAddUpIllnessMedical());
cellList.add(NumberUtil.isNumber(dto.getAddUpEnterpriseAndOther()) ? new BigDecimal(dto.getAddUpEnterpriseAndOther()) : dto.getAddUpEnterpriseAndOther());
cellList.add(NumberUtil.isNumber(dto.getAddUpOtherDeduction()) ? new BigDecimal(dto.getAddUpOtherDeduction()) : dto.getAddUpOtherDeduction());
cellList.add(NumberUtil.isNumber(dto.getAddUpTaxExemptIncome()) ? new BigDecimal(dto.getAddUpTaxExemptIncome()) : dto.getAddUpTaxExemptIncome());
cellList.add(NumberUtil.isNumber(dto.getAddUpAllowedDonation()) ? new BigDecimal(dto.getAddUpAllowedDonation()) : dto.getAddUpAllowedDonation());
cellList.add(NumberUtil.isNumber(dto.getAddUpTaxSavings()) ? new BigDecimal(dto.getAddUpTaxSavings()) : dto.getAddUpTaxSavings());
cellList.add(NumberUtil.isNumber(dto.getAddUpAdvanceTax()) ? new BigDecimal(dto.getAddUpAdvanceTax()) : dto.getAddUpAdvanceTax());
cellList.add(NumberUtil.isNumber(dto.getAddUpInfantCare()) ? new BigDecimal(dto.getAddUpInfantCare()) : dto.getAddUpInfantCare());
cellList.add(NumberUtil.isNumber(dto.getAddUpPrivatePension()) ? new BigDecimal(dto.getAddUpPrivatePension()) : dto.getAddUpPrivatePension());
return cellList;
}).collect(Collectors.toList()))
.orElse(Collections.emptyList());
List<List<String>> rowList = new ArrayList<>();
List<List<Object>> rowList = new ArrayList<>();
rowList.add(title);
rowList.addAll(dataRowList);
return rowList;
@ -441,10 +443,10 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
}
//获取操作按钮资源
List<List<String>> rowList = getExcelRowDetailList(queryParam);
List<List<Object>> rowList = getExcelRowDetailList(queryParam);
//获取excel
return ExcelUtil.genWorkbook(rowList, "累计情况明细");
return ExcelUtil.genWorkbookWithDefaultPattern(rowList, "累计情况明细", 2);
}

View File

@ -1,5 +1,6 @@
package com.engine.salary.service.impl;
import cn.hutool.core.util.NumberUtil;
import com.alibaba.druid.support.json.JSONUtils;
import com.alibaba.fastjson.JSONObject;
import com.api.formmode.mybatis.util.SqlProxyHandle;
@ -270,7 +271,16 @@ public class AttendQuoteDataServiceImpl extends Service implements AttendQuoteDa
// 动态列
for (AttendQuoteFieldPO attendQuoteField : attendQuoteFields) {
row.add(dto.get(attendQuoteField.getId().toString() + "_attendQuoteData"));
Object o = dto.get(attendQuoteField.getId().toString() + "_attendQuoteData");
try {
if (o != null && NumberUtil.isNumber(o.toString())) {
row.add(new BigDecimal(o.toString()));
} else {
row.add(o);
}
} catch (Exception e) {
row.add(o);
}
}
rows.add(row);
}

View File

@ -1,13 +1,14 @@
package com.engine.salary.service.impl;
import cn.hutool.core.util.NumberUtil;
import com.alibaba.fastjson.JSONObject;
import com.api.formmode.mybatis.util.SqlProxyHandle;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.hrmelog.entity.dto.LoggerContext;
import com.engine.salary.biz.OtherDeductionBiz;
import com.engine.salary.config.SalaryElogConfig;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.hrmelog.entity.dto.LoggerContext;
import com.engine.salary.encrypt.EncryptUtil;
import com.engine.salary.entity.datacollection.AddUpDeduction;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
@ -54,6 +55,7 @@ import weaver.general.Util;
import weaver.hrm.User;
import java.io.InputStream;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.YearMonth;
@ -490,7 +492,7 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
SalaryElogConfig.otherDeductionLoggerTemplate.write(loggerContext);
//获取excel
return ExcelUtil.genWorkbookV2(rowList, "其他免税扣除");
return ExcelUtil.genWorkbookV2WithDefaultPattern(rowList, "其他免税扣除", 2);
}
@ -534,11 +536,11 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
cellList.add(Util.null2String(dto.getJobNum()));
cellList.add(Util.null2String(dto.getIdNo()));
cellList.add(Util.null2String(dto.getHiredate()));
cellList.add(Util.null2String(dto.getBusinessHealthyInsurance()));
cellList.add(Util.null2String(dto.getTaxDelayEndowmentInsurance()));
cellList.add(Util.null2String(dto.getOtherDeduction()));
cellList.add(Util.null2String(dto.getDeductionAllowedDonation()));
cellList.add(Util.null2String(dto.getPrivatePension()));
cellList.add(NumberUtil.isNumber(dto.getBusinessHealthyInsurance()) ? new BigDecimal(dto.getBusinessHealthyInsurance()) : Util.null2String(dto.getBusinessHealthyInsurance()));
cellList.add(NumberUtil.isNumber(dto.getTaxDelayEndowmentInsurance()) ? new BigDecimal(dto.getTaxDelayEndowmentInsurance()) : Util.null2String(dto.getTaxDelayEndowmentInsurance()));
cellList.add(NumberUtil.isNumber(dto.getOtherDeduction()) ? new BigDecimal(dto.getOtherDeduction()) : Util.null2String(dto.getOtherDeduction()));
cellList.add(NumberUtil.isNumber(dto.getDeductionAllowedDonation()) ? new BigDecimal(dto.getDeductionAllowedDonation()) : Util.null2String(dto.getDeductionAllowedDonation()));
cellList.add(NumberUtil.isNumber(dto.getPrivatePension()) ? new BigDecimal(dto.getPrivatePension()) : Util.null2String(dto.getPrivatePension()));
return cellList;
}).collect(Collectors.toList()))
.orElse(Collections.emptyList());
@ -586,10 +588,10 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
//获取操作按钮资源
List<List<String>> rowList = getExcelRowDetailList(param);
List<List<Object>> rowList = getExcelRowDetailList(param);
//获取excel
return ExcelUtil.genWorkbook(rowList, "其他免税扣除明细");
return ExcelUtil.genWorkbookWithDefaultPattern(rowList, "其他免税扣除明细", 2);
}
@ -599,34 +601,34 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction
* @param param
* @return
*/
private List<List<String>> getExcelRowDetailList(OtherDeductionQueryParam param) {
private List<List<Object>> getExcelRowDetailList(OtherDeductionQueryParam param) {
//excel标题
List<String> title = Arrays.asList("姓名", "申报月份", "个税扣缴义务人", "部门", "手机号", "工号", "商业健康保险", "税延养老保险", "其他", "准予扣除的捐赠额", "个人养老金");
List<Object> title = Arrays.asList("姓名", "申报月份", "个税扣缴义务人", "部门", "手机号", "工号", "商业健康保险", "税延养老保险", "其他", "准予扣除的捐赠额", "个人养老金");
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM");
//查询详细信息
List<OtherDeductionRecordDTO> list = getOtherDeductionMapper().recordList(param);
encryptUtil.decryptList(list, OtherDeductionRecordDTO.class);
final List<List<String>> dataRowList = Optional.ofNullable(list)
final List<List<Object>> dataRowList = Optional.ofNullable(list)
.map(List::stream)
.map(operatorStream -> operatorStream.map(dto -> {
List<String> cellList = new ArrayList<>();
List<Object> cellList = new ArrayList<>();
cellList.add(Util.null2String(dto.getUsername()));
cellList.add(Util.null2String(dto.getDeclareMonth() == null ? "" : formatter.format(dto.getDeclareMonth())));
cellList.add(Util.null2String(dto.getTaxAgentName()));
cellList.add(Util.null2String(dto.getDepartmentName()));
cellList.add(Util.null2String(dto.getMobile()));
cellList.add(Util.null2String(dto.getJobNum()));
cellList.add(Util.null2String(dto.getBusinessHealthyInsurance()));
cellList.add(Util.null2String(dto.getTaxDelayEndowmentInsurance()));
cellList.add(Util.null2String(dto.getOtherDeduction()));
cellList.add(Util.null2String(dto.getDeductionAllowedDonation()));
cellList.add(Util.null2String(dto.getPrivatePension()));
cellList.add(NumberUtil.isNumber(dto.getBusinessHealthyInsurance()) ? new BigDecimal(dto.getBusinessHealthyInsurance()) : Util.null2String(dto.getBusinessHealthyInsurance()));
cellList.add(NumberUtil.isNumber(dto.getTaxDelayEndowmentInsurance()) ? new BigDecimal(dto.getTaxDelayEndowmentInsurance()) : Util.null2String(dto.getTaxDelayEndowmentInsurance()));
cellList.add(NumberUtil.isNumber(dto.getOtherDeduction()) ? new BigDecimal(dto.getOtherDeduction()) : Util.null2String(dto.getOtherDeduction()));
cellList.add(NumberUtil.isNumber(dto.getDeductionAllowedDonation()) ? new BigDecimal(dto.getDeductionAllowedDonation()) : Util.null2String(dto.getDeductionAllowedDonation()));
cellList.add(NumberUtil.isNumber(dto.getPrivatePension()) ? new BigDecimal(dto.getPrivatePension()) : Util.null2String(dto.getPrivatePension()));
return cellList;
}).collect(Collectors.toList()))
.orElse(Collections.emptyList());
List<List<String>> rowList = new ArrayList<>();
List<List<Object>> rowList = new ArrayList<>();
rowList.add(title);
rowList.addAll(dataRowList);
return rowList;

View File

@ -47,6 +47,7 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.general.BaseBean;
import weaver.hrm.User;
import java.math.BigDecimal;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -251,7 +252,15 @@ public class SIExportServiceImpl extends Service implements SIExportService {
for (Map<String, Object> recordData : records) {
List<Object> row = new LinkedList<>();
for (WeaTableColumn column : columns) {
row.add(recordData.get(column.getColumn()));
try {
if (column.getText().contains("个人") || column.getText().contains("单位") || column.getText().contains("合计")) {
row.add(new BigDecimal(recordData.get(column.getColumn()).toString()));
} else {
row.add(recordData.get(column.getColumn()));
}
} catch (Exception e) {
row.add(recordData.get(column.getColumn()));
}
}
rows.add(row);
}

View File

@ -624,7 +624,11 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
for (WeaTableColumn column : columns) {
try {
Object o = recordData.get(column.getColumn());
row.add(o.toString());
if (column.getText().contains("申报基数") && StringUtils.isNotBlank(o.toString())) {
row.add(new BigDecimal(o.toString()));
} else {
row.add(o.toString());
}
} catch (Exception e) {
row.add("");
}

View File

@ -1,5 +1,6 @@
package com.engine.salary.service.impl;
import cn.hutool.core.util.StrUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.cache.SalaryCacheKey;
@ -35,6 +36,7 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.springframework.util.StopWatch;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.wechat.util.Utils;
@ -111,7 +113,7 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
@Override
public void calculate(SalaryAcctCalculateBO salaryAcctCalculateBO, DataCollectionEmployee simpleEmployee, List<SalarySobBackItemPO> salarySobBackItems) {
StopWatch sw = new StopWatch("核算耗时明细id"+salaryAcctCalculateBO.getSalaryAcctRecordPO().getId()+"");
StopWatch sw = new StopWatch("核算耗时明细id" + salaryAcctCalculateBO.getSalaryAcctRecordPO().getId() + "");
Date now = new Date();
try {
// 数据库字段加密用
@ -213,16 +215,20 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
String resultValue;
SalaryItemPO salaryItemPO = salaryItemMap.get(salaryItemId);
ExpressFormula expressFormula;
String defaultValue;
if (salarySobBackItemMap.containsKey(salaryItemId)) {
// 如果薪资账套的回算项目中重新定义了回算项目公式则使用薪资账套下的公式
SalarySobBackItemPO salarySobBackItemPO = salarySobBackItemMap.get(salaryItemId);
expressFormula = expressFormulaMap.get(salarySobBackItemPO.getFormulaId());
defaultValue = salarySobBackItemPO.getDefaultValue();
} else if (salaryItemIdKeySalarySobItemPOMap.containsKey(salaryItemId)) {
// 如果薪资账套下重新定义了薪资项目的公式则使用薪资账套下的公式否则使用薪资项目本身的公式
SalarySobItemPO salarySobItemPO = salaryItemIdKeySalarySobItemPOMap.get(salaryItemId);
expressFormula = expressFormulaMap.get(salarySobItemPO.getFormulaId());
defaultValue = salarySobItemPO.getDefaultValue();
} else {
expressFormula = expressFormulaMap.get(salaryItemPO.getFormulaId());
defaultValue = salaryItemPO.getDefaultValue();
}
if (Objects.nonNull(expressFormula)) {
// 运行公式
@ -244,6 +250,9 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
// 处理取值类型为输入/导入的薪资项目
String key = SalaryFormulaReferenceEnum.SALARY_ITEM.getValue() + SalaryFormulaFieldConstant.FIELD_ID_SEPARATOR + salaryItemPO.getCode();
resultValue = formulaVarValueMap.getOrDefault(key, StringUtils.EMPTY);
if (StrUtil.isBlank(resultValue)) {
resultValue = Util.null2String(defaultValue);
}
}
// 处理薪资档案
if (Objects.equals(salaryItemPO.getUseInEmployeeSalary(), NumberUtils.INTEGER_ONE)) {

View File

@ -3,12 +3,13 @@ package com.engine.salary.service.impl;
import com.cloudstore.dev.api.util.Util_DataCache;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.hrmelog.entity.dto.LoggerContext;
import com.engine.salary.biz.*;
import com.engine.salary.common.LocalDateRange;
import com.engine.salary.component.WeaTableColumnGroup;
import com.engine.salary.config.SalaryElogConfig;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.constant.SalaryItemConstant;
import com.engine.hrmelog.entity.dto.LoggerContext;
import com.engine.salary.entity.datacollection.AddUpSituation;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.salaryarchive.bo.SalaryArchiveBO;
@ -28,6 +29,7 @@ import com.engine.salary.enums.OperateTypeEnum;
import com.engine.salary.enums.UserStatusEnum;
import com.engine.salary.enums.datacollection.UseEmployeeTypeEnum;
import com.engine.salary.enums.salaryarchive.*;
import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum;
import com.engine.salary.enums.taxagent.TaxAgentEmpChangeModuleEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.archive.SalaryArchiveItemMapper;
@ -68,6 +70,7 @@ import weaver.general.Util;
import weaver.hrm.User;
import java.io.InputStream;
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Pattern;
@ -521,19 +524,21 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
String sheetName = SalaryI18nUtil.getI18nLabel(85368, "薪资档案");
// 获取所有可被引用的薪资项目
List<SalaryItemPO> salaryItems = salaryItemMapper.getCanAdjustSalaryItems();
String[] header = {SalaryI18nUtil.getI18nLabel(85429, "姓名"),
SalaryI18nUtil.getI18nLabel(86184, "个税扣缴义务人"),
SalaryI18nUtil.getI18nLabel(86185, "部门"),
SalaryI18nUtil.getI18nLabel(86176, "工号"),
SalaryI18nUtil.getI18nLabel(86186, "手机号"),
SalaryI18nUtil.getI18nLabel(86186, "证件号码"),
SalaryI18nUtil.getI18nLabel(15890, "员工状态"),
SalaryI18nUtil.getI18nLabel(91075, "起始发薪日期"),
SalaryI18nUtil.getI18nLabel(91075, "最后发薪日期")};
Object[] header = {
new WeaTableColumnGroup("150px", SalaryI18nUtil.getI18nLabel(85429, "姓名"), "", "", 0),
new WeaTableColumnGroup("150px", SalaryI18nUtil.getI18nLabel(86184, "个税扣缴义务人"), "", "", 0),
new WeaTableColumnGroup("150px", SalaryI18nUtil.getI18nLabel(86185, "部门"), "", "", 0),
new WeaTableColumnGroup("150px", SalaryI18nUtil.getI18nLabel(86176, "工号"), "", "", 0),
new WeaTableColumnGroup("150px", SalaryI18nUtil.getI18nLabel(86186, "手机号"), "", "", 0),
new WeaTableColumnGroup("150px", SalaryI18nUtil.getI18nLabel(86186, "证件号码"), "", "", 0),
new WeaTableColumnGroup("150px", SalaryI18nUtil.getI18nLabel(15890, "员工状态"), "", "", 0),
new WeaTableColumnGroup("150px", SalaryI18nUtil.getI18nLabel(91075, "起始发薪日期"), "", "", 0),
new WeaTableColumnGroup("150px", SalaryI18nUtil.getI18nLabel(91075, "最后发薪日期"), "", "", 0)
};
// 2.表头
List<Object> headerList = new ArrayList<>(Arrays.asList(header));
for (SalaryItemPO salaryItem : salaryItems) {
headerList.add(salaryItem.getName());
headerList.add(new WeaTableColumnGroup("150px", salaryItem.getName(), "", "", salaryItem.getPattern()));
}
// 获取所有个税扣缴义务人
@ -588,7 +593,15 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
row.add(Util.null2String(e.get("payEndDate")));
// 薪资项目数据
for (SalaryItemPO salaryItem : salaryItems) {
row.add(e.containsKey(salaryItem.getId() + SalaryItemConstant.DYNAMIC_SUFFIX) ? (e.get(salaryItem.getId() + SalaryItemConstant.DYNAMIC_SUFFIX) == null ? "" : e.get(salaryItem.getId() + SalaryItemConstant.DYNAMIC_SUFFIX).toString()) : "");
try {
if (salaryItem.getDataType().equals(SalaryDataTypeEnum.NUMBER.getValue())) {
row.add(new BigDecimal(e.containsKey(salaryItem.getId() + SalaryItemConstant.DYNAMIC_SUFFIX) ? (e.get(salaryItem.getId() + SalaryItemConstant.DYNAMIC_SUFFIX) == null ? "" : e.get(salaryItem.getId() + SalaryItemConstant.DYNAMIC_SUFFIX).toString()) : ""));
} else {
row.add(e.containsKey(salaryItem.getId() + SalaryItemConstant.DYNAMIC_SUFFIX) ? (e.get(salaryItem.getId() + SalaryItemConstant.DYNAMIC_SUFFIX) == null ? "" : e.get(salaryItem.getId() + SalaryItemConstant.DYNAMIC_SUFFIX).toString()) : "");
}
} catch (Exception ex) {
row.add(e.containsKey(salaryItem.getId() + SalaryItemConstant.DYNAMIC_SUFFIX) ? (e.get(salaryItem.getId() + SalaryItemConstant.DYNAMIC_SUFFIX) == null ? "" : e.get(salaryItem.getId() + SalaryItemConstant.DYNAMIC_SUFFIX).toString()) : "");
}
}
rows.add(row);
});
@ -606,7 +619,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "薪资档案") + "-" + name);
loggerContext.setUser(user);
SalaryElogConfig.salaryArchiveLoggerTemplate.write(loggerContext);
return ExcelUtilPlus.genWorkbookV2(rows, sheetName);
return ExcelUtilPlus.genWorkbookV2WithPattern(rows, sheetName);
}

View File

@ -249,6 +249,7 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService
newSalaryItemPO.setTaxAgentIds(saveParam.getTaxAgentIds());
newSalaryItemPO.setSortedIndex(saveParam.getSortedIndex());
newSalaryItemPO.setWidth(saveParam.getWidth());
newSalaryItemPO.setDefaultValue(saveParam.getDefaultValue());
salaryItemBiz.updateById(newSalaryItemPO);
//改名后更新公式
@ -459,6 +460,7 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService
sobItem.setValueType(salaryItemPO.getValueType());
sobItem.setDescription(salaryItemPO.getDescription());
sobItem.setUpdateTime(now);
sobItem.setDefaultValue(salaryItemPO.getDefaultValue() == null ? "" : salaryItemPO.getDefaultValue());
getSalarySobItemService(user).update(sobItem);
}
}

View File

@ -390,7 +390,7 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
for (SalarySobItemSaveParam.SalarySobItemParam itemParam : itemGroupParam.getItems()) {
SalaryItemPO salaryItemPO = checkItemExists(itemParam.getSalaryItemId(), salaryItemsMap);
SalarySobItemPO salarySobItemPO = SalarySobItemPO.builder().salarySobId(salarySobId).salaryItemId(itemParam.getSalaryItemId()).salarySobItemGroupId(salarySobItemGroupId).formulaId(Optional.ofNullable(itemParam.getFormulaId()).orElse(NumberUtils.LONG_ZERO)).sortedIndex(itemParam.getSortedIndex()).description(StringUtils.EMPTY).creator(employeeId).createTime(now).updateTime(now).deleteType(NumberUtils.INTEGER_ZERO).tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY).canDelete(itemParam.getCanDelete() == null ? NumberUtils.INTEGER_ONE : (itemParam.getCanDelete() ? NumberUtils.INTEGER_ONE : NumberUtils.INTEGER_ZERO)).roundingMode(itemParam.getRoundingMode() == null ? salaryItemPO.getRoundingMode() : itemParam.getRoundingMode()).pattern(itemParam.getPattern() == null ? salaryItemPO.getPattern() : itemParam.getPattern()).valueType(itemParam.getValueType() == null ? salaryItemPO.getValueType() : itemParam.getValueType()).itemHide(itemParam.getItemHide()).build();
SalarySobItemPO salarySobItemPO = SalarySobItemPO.builder().salarySobId(salarySobId).salaryItemId(itemParam.getSalaryItemId()).salarySobItemGroupId(salarySobItemGroupId).formulaId(Optional.ofNullable(itemParam.getFormulaId()).orElse(NumberUtils.LONG_ZERO)).sortedIndex(itemParam.getSortedIndex()).description(StringUtils.EMPTY).creator(employeeId).createTime(now).updateTime(now).deleteType(NumberUtils.INTEGER_ZERO).tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY).canDelete(itemParam.getCanDelete() == null ? NumberUtils.INTEGER_ONE : (itemParam.getCanDelete() ? NumberUtils.INTEGER_ONE : NumberUtils.INTEGER_ZERO)).roundingMode(itemParam.getRoundingMode() == null ? salaryItemPO.getRoundingMode() : itemParam.getRoundingMode()).pattern(itemParam.getPattern() == null ? salaryItemPO.getPattern() : itemParam.getPattern()).valueType(itemParam.getValueType() == null ? salaryItemPO.getValueType() : itemParam.getValueType()).itemHide(itemParam.getItemHide()).defaultValue(itemParam.getDefaultValue()).build();
salarySobItems.add(salarySobItemPO);
}
}
@ -414,13 +414,13 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
//新增
for (SalarySobItemSaveParam.SalarySobItemParam itemParam : needAddItems) {
SalaryItemPO salaryItemPO = checkItemExists(itemParam.getSalaryItemId(), salaryItemsMap);
SalarySobItemPO salarySobItemPO = SalarySobItemPO.builder().salarySobId(salarySobId).salaryItemId(itemParam.getSalaryItemId()).salarySobItemGroupId(groupId).formulaId(Optional.ofNullable(itemParam.getFormulaId()).orElse(NumberUtils.LONG_ZERO)).canDelete(itemParam.getCanDelete() == null ? NumberUtils.INTEGER_ONE : (itemParam.getCanDelete() ? NumberUtils.INTEGER_ONE : NumberUtils.INTEGER_ZERO)).sortedIndex(itemParam.getSortedIndex()).description(StringUtils.EMPTY).creator(employeeId).createTime(now).updateTime(now).tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY).deleteType(NumberUtils.INTEGER_ZERO).roundingMode(itemParam.getRoundingMode() == null ? salaryItemPO.getRoundingMode() : itemParam.getRoundingMode()).pattern(itemParam.getPattern() == null ? salaryItemPO.getPattern() : itemParam.getPattern()).valueType(itemParam.getValueType() == null ? salaryItemPO.getValueType() : itemParam.getValueType()).itemHide(itemParam.getItemHide()).build();
SalarySobItemPO salarySobItemPO = SalarySobItemPO.builder().salarySobId(salarySobId).salaryItemId(itemParam.getSalaryItemId()).salarySobItemGroupId(groupId).formulaId(Optional.ofNullable(itemParam.getFormulaId()).orElse(NumberUtils.LONG_ZERO)).canDelete(itemParam.getCanDelete() == null ? NumberUtils.INTEGER_ONE : (itemParam.getCanDelete() ? NumberUtils.INTEGER_ONE : NumberUtils.INTEGER_ZERO)).sortedIndex(itemParam.getSortedIndex()).description(StringUtils.EMPTY).creator(employeeId).createTime(now).updateTime(now).tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY).deleteType(NumberUtils.INTEGER_ZERO).roundingMode(itemParam.getRoundingMode() == null ? salaryItemPO.getRoundingMode() : itemParam.getRoundingMode()).pattern(itemParam.getPattern() == null ? salaryItemPO.getPattern() : itemParam.getPattern()).valueType(itemParam.getValueType() == null ? salaryItemPO.getValueType() : itemParam.getValueType()).itemHide(itemParam.getItemHide()).defaultValue(itemParam.getDefaultValue()).build();
salarySobItems.add(salarySobItemPO);
}
//更新
for (SalarySobItemSaveParam.SalarySobItemParam itemParam : needUpdateItems) {
SalaryItemPO salaryItemPO = checkItemExists(itemParam.getSalaryItemId(), salaryItemsMap);
SalarySobItemPO salarySobItemPO = SalarySobItemPO.builder().id(itemParam.getId()).salaryItemId(itemParam.getSalaryItemId()).salarySobItemGroupId(groupId).formulaId(Optional.ofNullable(itemParam.getFormulaId()).orElse(NumberUtils.LONG_ZERO)).sortedIndex(itemParam.getSortedIndex()).canDelete(itemParam.getCanDelete() == null ? NumberUtils.INTEGER_ONE : (itemParam.getCanDelete() ? NumberUtils.INTEGER_ONE : NumberUtils.INTEGER_ZERO)).updateTime(now).deleteType(NumberUtils.INTEGER_ZERO).roundingMode(itemParam.getRoundingMode() == null ? salaryItemPO.getRoundingMode() : itemParam.getRoundingMode()).pattern(itemParam.getPattern() == null ? salaryItemPO.getPattern() : itemParam.getPattern()).valueType(itemParam.getValueType() == null ? salaryItemPO.getValueType() : itemParam.getValueType()).itemHide(itemParam.getItemHide()).build();
SalarySobItemPO salarySobItemPO = SalarySobItemPO.builder().id(itemParam.getId()).salaryItemId(itemParam.getSalaryItemId()).salarySobItemGroupId(groupId).formulaId(Optional.ofNullable(itemParam.getFormulaId()).orElse(NumberUtils.LONG_ZERO)).sortedIndex(itemParam.getSortedIndex()).canDelete(itemParam.getCanDelete() == null ? NumberUtils.INTEGER_ONE : (itemParam.getCanDelete() ? NumberUtils.INTEGER_ONE : NumberUtils.INTEGER_ZERO)).updateTime(now).deleteType(NumberUtils.INTEGER_ZERO).roundingMode(itemParam.getRoundingMode() == null ? salaryItemPO.getRoundingMode() : itemParam.getRoundingMode()).pattern(itemParam.getPattern() == null ? salaryItemPO.getPattern() : itemParam.getPattern()).valueType(itemParam.getValueType() == null ? salaryItemPO.getValueType() : itemParam.getValueType()).itemHide(itemParam.getItemHide()).defaultValue(itemParam.getDefaultValue()).build();
getSalarySobItemMapper().updateIgnoreNull(salarySobItemPO);
}
@ -447,13 +447,13 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
for (SalarySobItemSaveParam.SalarySobItemParam itemParam : needAddItems) {
SalaryItemPO salaryItemPO = checkItemExists(itemParam.getSalaryItemId(), salaryItemsMap);
SalarySobItemPO salarySobItemPO = SalarySobItemPO.builder().salarySobId(salarySobId).salaryItemId(itemParam.getSalaryItemId()).salarySobItemGroupId(NumberUtils.LONG_ZERO).formulaId(Optional.ofNullable(itemParam.getFormulaId()).orElse(NumberUtils.LONG_ZERO)).sortedIndex(itemParam.getSortedIndex()).description(StringUtils.EMPTY).creator(employeeId).createTime(now).updateTime(now).deleteType(NumberUtils.INTEGER_ZERO).tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY).canDelete(itemParam.getCanDelete() == null ? NumberUtils.INTEGER_ONE : (itemParam.getCanDelete() ? NumberUtils.INTEGER_ONE : NumberUtils.INTEGER_ZERO)).roundingMode(itemParam.getRoundingMode() == null ? salaryItemPO.getRoundingMode() : itemParam.getRoundingMode()).pattern(itemParam.getPattern() == null ? salaryItemPO.getPattern() : itemParam.getPattern()).valueType(itemParam.getValueType() == null ? salaryItemPO.getValueType() : itemParam.getValueType()).itemHide(itemParam.getItemHide()).build();
SalarySobItemPO salarySobItemPO = SalarySobItemPO.builder().salarySobId(salarySobId).salaryItemId(itemParam.getSalaryItemId()).salarySobItemGroupId(NumberUtils.LONG_ZERO).formulaId(Optional.ofNullable(itemParam.getFormulaId()).orElse(NumberUtils.LONG_ZERO)).sortedIndex(itemParam.getSortedIndex()).description(StringUtils.EMPTY).creator(employeeId).createTime(now).updateTime(now).deleteType(NumberUtils.INTEGER_ZERO).tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY).canDelete(itemParam.getCanDelete() == null ? NumberUtils.INTEGER_ONE : (itemParam.getCanDelete() ? NumberUtils.INTEGER_ONE : NumberUtils.INTEGER_ZERO)).roundingMode(itemParam.getRoundingMode() == null ? salaryItemPO.getRoundingMode() : itemParam.getRoundingMode()).pattern(itemParam.getPattern() == null ? salaryItemPO.getPattern() : itemParam.getPattern()).valueType(itemParam.getValueType() == null ? salaryItemPO.getValueType() : itemParam.getValueType()).itemHide(itemParam.getItemHide()).defaultValue(itemParam.getDefaultValue()).build();
salarySobItems.add(salarySobItemPO);
}
for (SalarySobItemSaveParam.SalarySobItemParam itemParam : needUpdateItems) {
SalaryItemPO salaryItemPO = checkItemExists(itemParam.getSalaryItemId(), salaryItemsMap);
SalarySobItemPO salarySobItemPO = SalarySobItemPO.builder().id(itemParam.getId()).formulaId(Optional.ofNullable(itemParam.getFormulaId()).orElse(NumberUtils.LONG_ZERO)).sortedIndex(itemParam.getSortedIndex()).updateTime(now).canDelete(itemParam.getCanDelete() == null ? NumberUtils.INTEGER_ONE : (itemParam.getCanDelete() ? NumberUtils.INTEGER_ONE : NumberUtils.INTEGER_ZERO)).roundingMode(itemParam.getRoundingMode() == null ? salaryItemPO.getRoundingMode() : itemParam.getRoundingMode()).pattern(itemParam.getPattern() == null ? salaryItemPO.getPattern() : itemParam.getPattern()).valueType(itemParam.getValueType() == null ? salaryItemPO.getValueType() : itemParam.getValueType()).itemHide(itemParam.getItemHide()).build();
SalarySobItemPO salarySobItemPO = SalarySobItemPO.builder().id(itemParam.getId()).formulaId(Optional.ofNullable(itemParam.getFormulaId()).orElse(NumberUtils.LONG_ZERO)).sortedIndex(itemParam.getSortedIndex()).updateTime(now).canDelete(itemParam.getCanDelete() == null ? NumberUtils.INTEGER_ONE : (itemParam.getCanDelete() ? NumberUtils.INTEGER_ONE : NumberUtils.INTEGER_ZERO)).roundingMode(itemParam.getRoundingMode() == null ? salaryItemPO.getRoundingMode() : itemParam.getRoundingMode()).pattern(itemParam.getPattern() == null ? salaryItemPO.getPattern() : itemParam.getPattern()).valueType(itemParam.getValueType() == null ? salaryItemPO.getValueType() : itemParam.getValueType()).itemHide(itemParam.getItemHide()).defaultValue(itemParam.getDefaultValue()).build();
getSalarySobItemMapper().updateIgnoreNull(salarySobItemPO);
}
@ -579,7 +579,8 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
.setOriginSqlContent(valueType.equals(SalaryValueTypeEnum.SQL.getValue()) ? formulaContent : "")
.setUseInEmployeeSalary(salaryItemPO.getUseInEmployeeSalary())
.setDescription(salarySobItemPO.getDescription())
.setCanEdit((openFormulaForcedEditing || salaryItemPO.getCanEdit().equals(1)) ? 1 : 0);
.setCanEdit((openFormulaForcedEditing || salaryItemPO.getCanEdit().equals(1)) ? 1 : 0)
.setDefaultValue(salarySobItemPO.getDefaultValue());
}
return salarySobItemFormDTO;
}

View File

@ -1,12 +1,13 @@
package com.engine.salary.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.NumberUtil;
import com.api.formmode.mybatis.util.SqlProxyHandle;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.hrmelog.entity.dto.LoggerContext;
import com.engine.salary.biz.SpecialAddDeductionBiz;
import com.engine.salary.config.SalaryElogConfig;
import com.engine.hrmelog.entity.dto.LoggerContext;
import com.engine.salary.encrypt.EncryptUtil;
import com.engine.salary.entity.datacollection.AddUpDeduction;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
@ -53,6 +54,7 @@ import weaver.general.Util;
import weaver.hrm.User;
import java.io.InputStream;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.time.YearMonth;
import java.util.*;
@ -371,7 +373,7 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
public XSSFWorkbook export(SpecialAddDeductionQueryParam param, boolean isTemplate) {
//获取操作按钮资源
List<List<String>> rowList = getExcelRowList(param, isTemplate);
List<List<Object>> rowList = getExcelRowList(param, isTemplate);
// 记录操作日志
String name = SalaryI18nUtil.getI18nLabel(0, "导出");
@ -384,7 +386,7 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
SalaryElogConfig.specialAddDeductionLoggerTemplate.write(loggerContext);
//获取excel
return ExcelUtil.genWorkbook(rowList, "专项附加免税扣除");
return ExcelUtil.genWorkbookWithDefaultPattern(rowList, "专项附加免税扣除", 2);
}
@ -393,16 +395,16 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
*
* @return 导出数据行集合
*/
private List<List<String>> getExcelRowList(SpecialAddDeductionQueryParam param, boolean isTemplate) {
private List<List<Object>> getExcelRowList(SpecialAddDeductionQueryParam param, boolean isTemplate) {
long employeeId = user.getUID();
//excel标题
List<String> title = Arrays.asList("姓名", "个税扣缴义务人", "部门", "手机号", "工号", "证件号码", "入职日期", "子女教育", "继续教育", "住房贷款利息", "住房租金", "赡养老人", "大病医疗", "婴幼儿照护");
List<Object> title = Arrays.asList("姓名", "个税扣缴义务人", "部门", "手机号", "工号", "证件号码", "入职日期", "子女教育", "继续教育", "住房贷款利息", "住房租金", "赡养老人", "大病医疗", "婴幼儿照护");
List<List<String>> rowList = new ArrayList<>();
List<List<Object>> rowList = new ArrayList<>();
rowList.add(title);
if (!isTemplate || param.isHasData()) {
// 非下载导入模版查询数据填充
List<List<String>> dataRowList = queryInfoForExcel(param, rowList);
List<List<Object>> dataRowList = queryInfoForExcel(param, rowList);
rowList.addAll(dataRowList);
}
return rowList;
@ -439,10 +441,10 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
//获取操作按钮资源
List<List<String>> rowList = getExcelRowDetailList(param);
List<List<Object>> rowList = getExcelRowDetailList(param);
//获取excel
return ExcelUtil.genWorkbook(rowList, "专项附加扣除明细");
return ExcelUtil.genWorkbookWithDefaultPattern(rowList, "专项附加扣除明细", 2);
}
@ -452,35 +454,35 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
* @param param
* @return
*/
private List<List<String>> getExcelRowDetailList(SpecialAddDeductionQueryParam param) {
private List<List<Object>> getExcelRowDetailList(SpecialAddDeductionQueryParam param) {
//excel标题
List<String> title = Arrays.asList("姓名", "个税扣缴义务人", "部门", "手机号", "工号", "子女教育", "继续教育", "住房贷款利息", "住房租金", "赡养老人", "大病医疗", "婴幼儿照护");
List<Object> title = Arrays.asList("姓名", "个税扣缴义务人", "部门", "手机号", "工号", "子女教育", "继续教育", "住房贷款利息", "住房租金", "赡养老人", "大病医疗", "婴幼儿照护");
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM");
//查询详细信息
List<SpecialAddDeductionRecordDTO> list = getSpecialAddDeductionBiz().listDTOByParam(param);
encryptUtil.decryptList(list, SpecialAddDeductionRecordDTO.class);
final List<List<String>> dataRowList = Optional.ofNullable(list)
final List<List<Object>> dataRowList = Optional.ofNullable(list)
.map(List::stream)
.map(operatorStream -> operatorStream.map(dto -> {
List<String> cellList = new ArrayList<>();
List<Object> cellList = new ArrayList<>();
cellList.add(Util.null2String(dto.getUsername()));
cellList.add(Util.null2String(dto.getTaxAgentName()));
cellList.add(Util.null2String(dto.getDepartmentName()));
cellList.add(Util.null2String(dto.getMobile()));
cellList.add(Util.null2String(dto.getJobNum()));
cellList.add(Util.null2String(dto.getChildrenEducation()));
cellList.add(Util.null2String(dto.getContinuingEducation()));
cellList.add(Util.null2String(dto.getHousingLoanInterest()));
cellList.add(Util.null2String(dto.getHousingRent()));
cellList.add(Util.null2String(dto.getSupportingElder()));
cellList.add(Util.null2String(dto.getSeriousIllnessTreatment()));
cellList.add(Util.null2String(dto.getInfantCare()));
cellList.add(NumberUtil.isNumber(dto.getChildrenEducation()) ? new BigDecimal(dto.getChildrenEducation()) : Util.null2String(dto.getChildrenEducation()));
cellList.add(NumberUtil.isNumber(dto.getContinuingEducation()) ? new BigDecimal(dto.getContinuingEducation()) : Util.null2String(dto.getContinuingEducation()));
cellList.add(NumberUtil.isNumber(dto.getHousingLoanInterest()) ? new BigDecimal(dto.getHousingLoanInterest()) : Util.null2String(dto.getHousingLoanInterest()));
cellList.add(NumberUtil.isNumber(dto.getHousingRent()) ? new BigDecimal(dto.getHousingRent()) : Util.null2String(dto.getHousingRent()));
cellList.add(NumberUtil.isNumber(dto.getSupportingElder()) ? new BigDecimal(dto.getSupportingElder()) : Util.null2String(dto.getSupportingElder()));
cellList.add(NumberUtil.isNumber(dto.getSeriousIllnessTreatment()) ? new BigDecimal(dto.getSeriousIllnessTreatment()) : Util.null2String(dto.getSeriousIllnessTreatment()));
cellList.add(NumberUtil.isNumber(dto.getInfantCare()) ? new BigDecimal(dto.getInfantCare()) : Util.null2String(dto.getInfantCare()));
return cellList;
}).collect(Collectors.toList()))
.orElse(Collections.emptyList());
List<List<String>> rowList = new ArrayList<>();
List<List<Object>> rowList = new ArrayList<>();
rowList.add(title);
rowList.addAll(dataRowList);
return rowList;
@ -700,7 +702,7 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
return CollUtil.isNotEmpty(specialAddDeductionRecordDTOList) ? specialAddDeductionRecordDTOList.get(0) : null;
}
private List<List<String>> queryInfoForExcel(SpecialAddDeductionQueryParam param, List<List<String>> rowList) {
private List<List<Object>> queryInfoForExcel(SpecialAddDeductionQueryParam param, List<List<Object>> rowList) {
//排序配置
OrderRuleVO orderRule = getSalarySysConfService(user).orderRule();
param.setOrderRule(orderRule);
@ -709,10 +711,10 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
putQueryRange(param);
}
List<SpecialAddDeductionListDTO> list = getSpecialAddDeductionBiz().listByParam(param);
final List<List<String>> dataRowList = Optional.ofNullable(list)
final List<List<Object>> dataRowList = Optional.ofNullable(list)
.map(List::stream)
.map(operatorStream -> operatorStream.map(dto -> {
List<String> cellList = new ArrayList<>();
List<Object> cellList = new ArrayList<>();
cellList.add(Util.null2String(dto.getUsername()));
cellList.add(Util.null2String(dto.getTaxAgentName()));
cellList.add(Util.null2String(dto.getDepartmentName()));
@ -720,13 +722,13 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
cellList.add(Util.null2String(dto.getJobNum()));
cellList.add(Util.null2String(dto.getIdNo()));
cellList.add(Util.null2String(dto.getHiredate()));
cellList.add(Util.null2String(dto.getChildrenEducation()));
cellList.add(Util.null2String(dto.getContinuingEducation()));
cellList.add(Util.null2String(dto.getHousingLoanInterest()));
cellList.add(Util.null2String(dto.getHousingRent()));
cellList.add(Util.null2String(dto.getSupportingElder()));
cellList.add(Util.null2String(dto.getSeriousIllnessTreatment()));
cellList.add(Util.null2String(dto.getInfantCare()));
cellList.add(NumberUtil.isNumber(dto.getChildrenEducation()) ? new BigDecimal(dto.getChildrenEducation()) : Util.null2String(dto.getChildrenEducation()));
cellList.add(NumberUtil.isNumber(dto.getContinuingEducation()) ? new BigDecimal(dto.getContinuingEducation()) : Util.null2String(dto.getContinuingEducation()));
cellList.add(NumberUtil.isNumber(dto.getHousingLoanInterest()) ? new BigDecimal(dto.getHousingLoanInterest()) : Util.null2String(dto.getHousingLoanInterest()));
cellList.add(NumberUtil.isNumber(dto.getHousingRent()) ? new BigDecimal(dto.getHousingRent()) : Util.null2String(dto.getHousingRent()));
cellList.add(NumberUtil.isNumber(dto.getSupportingElder()) ? new BigDecimal(dto.getSupportingElder()) : Util.null2String(dto.getSupportingElder()));
cellList.add(NumberUtil.isNumber(dto.getSeriousIllnessTreatment()) ? new BigDecimal(dto.getSeriousIllnessTreatment()) : Util.null2String(dto.getSeriousIllnessTreatment()));
cellList.add(NumberUtil.isNumber(dto.getInfantCare()) ? new BigDecimal(dto.getInfantCare()) : Util.null2String(dto.getInfantCare()));
return cellList;
}).collect(Collectors.toList()))
.orElse(Collections.emptyList());

View File

@ -4,6 +4,7 @@ import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.config.SalaryElogConfig;
import com.engine.hrmelog.entity.dto.LoggerContext;
import com.engine.salary.constant.TaxDeclarationDataIndexConstant;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationAnnualListDTO;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationLaborListDTO;
@ -28,9 +29,8 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.hrm.User;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.math.BigDecimal;
import java.util.*;
/**
* 个税申报表导出
@ -74,6 +74,16 @@ public class TaxDeclarationExcelServiceImpl extends Service implements TaxDeclar
List<List<Object>> rows = Lists.newArrayListWithExpectedSize(count);
List<Object> headerList = Lists.newArrayList();
List<String> dataIndexList = Lists.newArrayList();
List<String> NumberCode = Arrays.asList(TaxDeclarationDataIndexConstant.INCOME, TaxDeclarationDataIndexConstant.TAX_FREE_INCOME,
TaxDeclarationDataIndexConstant.ENDOWMENT_INSURANCE, TaxDeclarationDataIndexConstant.MEDICAL_INSURANCE, TaxDeclarationDataIndexConstant.UNEMPLOYMENT_INSURANCE,
TaxDeclarationDataIndexConstant.HOUSING_PROVIDENT_FUND, TaxDeclarationDataIndexConstant.ADD_UP_CHILD_EDUCATION, TaxDeclarationDataIndexConstant.ADD_UP_CONTINUING_EDUCATION,
TaxDeclarationDataIndexConstant.ADD_UP_HOUSING_LOAN_INTEREST, TaxDeclarationDataIndexConstant.ADD_UP_HOUSING_RENT, TaxDeclarationDataIndexConstant.ADD_UP_SUPPORT_ELDERLY,
TaxDeclarationDataIndexConstant.ADD_UP_ILLNESS_MEDICAL, TaxDeclarationDataIndexConstant.ADD_UP_INFANT_CARE, TaxDeclarationDataIndexConstant.ADD_UP_PRIVATE_PENSION,
TaxDeclarationDataIndexConstant.ANNUITY, TaxDeclarationDataIndexConstant.COMMERCIAL_HEALTH_INSURANCE, TaxDeclarationDataIndexConstant.TAX_DEFERRED_ENDOWMENT_INSURANCE,
TaxDeclarationDataIndexConstant.OTHER, TaxDeclarationDataIndexConstant.ALLOWED_DONATION, TaxDeclarationDataIndexConstant.TAX_DEDUCTION,
TaxDeclarationDataIndexConstant.LABOR_INCOME, TaxDeclarationDataIndexConstant.LABOR_TAX_FREE_INCOME, TaxDeclarationDataIndexConstant.ANNUAL_INCOME,
TaxDeclarationDataIndexConstant.ANNUAL_TAX_FREE_INCOME, TaxDeclarationDataIndexConstant.ANNUAL_OTHER, TaxDeclarationDataIndexConstant.ANNUAL_DONATE_TAX,
TaxDeclarationDataIndexConstant.ANNUAL_TAX_SAVINGS);
if (Objects.equals(taxDeclarationPO.getIncomeCategory(), IncomeCategoryEnum.WAGES_AND_SALARIES.getValue())) {
// 解析表头
ExcelUtil.parseHeader(TaxDeclarationWageListDTO.class, headerList, dataIndexList);
@ -89,7 +99,15 @@ public class TaxDeclarationExcelServiceImpl extends Service implements TaxDeclar
List<Object> row = Lists.newArrayListWithExpectedSize(dataIndexList.size());
Map<String, Object> map = JsonUtil.parseMap(taxDeclarationWageListDTO, Object.class);
for (String dataIndex : dataIndexList) {
row.add(map.get(dataIndex));
try {
if (NumberCode.contains(dataIndex)) {
row.add(new BigDecimal(map.get(dataIndex).toString()));
} else {
row.add(map.get(dataIndex));
}
} catch (Exception e) {
row.add(map.get(dataIndex));
}
}
rows.add(row);
}
@ -110,7 +128,15 @@ public class TaxDeclarationExcelServiceImpl extends Service implements TaxDeclar
List<Object> row = Lists.newArrayListWithExpectedSize(dataIndexList.size());
Map<String, Object> map = JsonUtil.parseMap(taxDeclarationLaborListDTO, Object.class);
for (String dataIndex : dataIndexList) {
row.add(map.get(dataIndex));
try {
if (NumberCode.contains(dataIndex)) {
row.add(new BigDecimal(map.get(dataIndex).toString()));
} else {
row.add(map.get(dataIndex));
}
} catch (Exception e) {
row.add(map.get(dataIndex));
}
}
rows.add(row);
}
@ -132,7 +158,15 @@ public class TaxDeclarationExcelServiceImpl extends Service implements TaxDeclar
List<Object> row = Lists.newArrayListWithExpectedSize(dataIndexList.size());
Map<String, Object> map = JsonUtil.parseMap(taxDeclarationLaborListDTO, Object.class);
for (String dataIndex : dataIndexList) {
row.add(map.get(dataIndex));
try {
if (NumberCode.contains(dataIndex)) {
row.add(new BigDecimal(map.get(dataIndex).toString()));
} else {
row.add(map.get(dataIndex));
}
} catch (Exception e) {
row.add(map.get(dataIndex));
}
}
rows.add(row);
}

View File

@ -10,6 +10,7 @@ import org.apache.poi.ss.usermodel.FillPatternType;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.IndexedColors;
import org.apache.poi.xssf.usermodel.*;
import org.springframework.beans.BeanUtils;
import java.awt.*;
import java.beans.BeanInfo;
@ -17,11 +18,15 @@ import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class ExcelUtil {
/**
* 生成excel
*
@ -76,6 +81,82 @@ public class ExcelUtil {
return workbook;
}
// 设置默认舍入位数可设为null
public static XSSFWorkbook genWorkbookWithDefaultPattern(List<List<Object>> rowList, String sheetName, Integer defaultPattern) {
XSSFWorkbook workbook = new XSSFWorkbook();
// 设置title样式
XSSFCellStyle titleCellStyle = workbook.createCellStyle();
XSSFFont titleFont = workbook.createFont();
titleFont.setFontName("仿宋");
titleFont.setFontHeightInPoints((short) 15);
titleCellStyle.setFont(titleFont);
titleCellStyle.setAlignment(HorizontalAlignment.CENTER);
titleCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());//背景色
titleCellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
// 设置主体样式
XSSFCellStyle cellStyle = workbook.createCellStyle();
XSSFFont font = workbook.createFont();
font.setFontName("宋体");
font.setFontHeightInPoints((short) 10);// 设置字体大小
cellStyle.setFont(font);// 选择需要用到的字体格式
cellStyle.setWrapText(true);
XSSFSheet sheet = workbook.createSheet(sheetName);
//自适应宽度
sheet.autoSizeColumn(0, true);
//默认列宽
sheet.setDefaultColumnWidth(20);
//默认行高
sheet.setDefaultRowHeightInPoints(18);
XSSFCellStyle numberCellStyle = null;
if (defaultPattern != null) {
XSSFDataFormat df = workbook.createDataFormat();
String start = "0.";
if (defaultPattern.equals(0)) {
start = "0";
}
short format = df.getFormat(start + Stream.generate(() -> "0").limit(defaultPattern).collect(Collectors.joining()) + "_ ");
numberCellStyle = workbook.createCellStyle();
BeanUtils.copyProperties(cellStyle, numberCellStyle);
numberCellStyle.setDataFormat(format);
}
for (int rowIndex = 0; rowIndex < rowList.size(); rowIndex++) {
List<Object> infoList = rowList.get(rowIndex);
XSSFRow row = sheet.createRow(rowIndex);
for (int cellIndex = 0; cellIndex < infoList.size(); cellIndex++) {
XSSFCell cell = row.createCell(cellIndex);
cell.setCellType(CellType.STRING);
if (rowIndex == 0) {
cell.setCellStyle(titleCellStyle);
} else {
cell.setCellStyle(cellStyle);
}
Object o = infoList.get(cellIndex);
if (o instanceof String) {
cell.setCellType(CellType.STRING);
cell.setCellValue(String.valueOf(o));
} else if (o instanceof BigDecimal) {
cell.setCellType(CellType.NUMERIC);
cell.setCellValue(o == null ? 0 : ((BigDecimal) o).doubleValue());
if (defaultPattern != null) {
cell.setCellStyle(numberCellStyle);
}
} else {
cell.setCellType(CellType.STRING);
cell.setCellValue(o == null ? "" : o.toString());
}
// sheet.setColumnWidth(cellIndex, 35 * 256);
}
}
return workbook;
}
public static <T> XSSFWorkbook genWorkbook(String sheetName, List<T> rowList) {
List<Object> headerList = Lists.newArrayList();
List<String> dataIndexList = Lists.newArrayList();
@ -156,6 +237,88 @@ public class ExcelUtil {
if (o instanceof String) {
cell.setCellType(CellType.STRING);
cell.setCellValue(String.valueOf(o));
} else if (o instanceof BigDecimal) {
cell.setCellType(CellType.NUMERIC);
cell.setCellValue(o == null ? 0 : ((BigDecimal) o).doubleValue());
} else if (o instanceof Boolean) {
cell.setCellType(CellType.BOOLEAN);
cell.setCellValue(String.valueOf(o));
} else if (o instanceof Date) {
cell.setCellType(CellType.STRING);
cell.setCellValue(SalaryDateUtil.getFormatLocalDate((Date) o));
} else {
cell.setCellType(CellType.STRING);
cell.setCellValue(o == null ? "" : o.toString());
}
}
}
return workbook;
}
// 设置默认舍入位数,可传null
public static XSSFWorkbook genWorkbookV2WithDefaultPattern(List<List<Object>> rowList, String sheetName, Integer defaultPattern) {
XSSFWorkbook workbook = new XSSFWorkbook();
// 设置title样式
XSSFCellStyle titleCellStyle = workbook.createCellStyle();
XSSFFont titleFont = workbook.createFont();
titleFont.setFontName("仿宋");
titleFont.setFontHeightInPoints((short) 15);
titleCellStyle.setFont(titleFont);
titleCellStyle.setAlignment(HorizontalAlignment.CENTER);
titleCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());//背景色
titleCellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
// 设置主体样式
XSSFCellStyle cellStyle = workbook.createCellStyle();
XSSFFont font = workbook.createFont();
font.setFontName("宋体");
font.setFontHeightInPoints((short) 10);// 设置字体大小
cellStyle.setFont(font);// 选择需要用到的字体格式
cellStyle.setWrapText(true);
XSSFSheet sheet = workbook.createSheet(sheetName);
//自适应宽度
sheet.autoSizeColumn(0, true);
//默认列宽
sheet.setDefaultColumnWidth(20);
//默认行高
sheet.setDefaultRowHeightInPoints(18);
XSSFCellStyle numberCellStyle = null;
if (defaultPattern != null) {
XSSFDataFormat df = workbook.createDataFormat();
String start = "0.";
if (defaultPattern.equals(0)) {
start = "0";
}
short format = df.getFormat(start + Stream.generate(() -> "0").limit(defaultPattern).collect(Collectors.joining()) + "_ ");
numberCellStyle = workbook.createCellStyle();
BeanUtils.copyProperties(cellStyle, numberCellStyle);
numberCellStyle.setDataFormat(format);
}
for (int rowIndex = 0; rowIndex < rowList.size(); rowIndex++) {
List<Object> infoList = rowList.get(rowIndex);
XSSFRow row = sheet.createRow(rowIndex);
for (int cellIndex = 0; cellIndex < infoList.size(); cellIndex++) {
XSSFCell cell = row.createCell(cellIndex);
if (rowIndex == 0) {
cell.setCellStyle(titleCellStyle);
} else {
cell.setCellStyle(cellStyle);
}
Object o = infoList.get(cellIndex);
if (o instanceof String) {
cell.setCellType(CellType.STRING);
cell.setCellValue(String.valueOf(o));
} else if (o instanceof BigDecimal) {
cell.setCellType(CellType.NUMERIC);
cell.setCellValue(o == null ? 0 : ((BigDecimal) o).doubleValue());
if (defaultPattern != null) {
cell.setCellStyle(numberCellStyle);
}
} else if (o instanceof Boolean) {
cell.setCellType(CellType.BOOLEAN);
cell.setCellValue(String.valueOf(o));

View File

@ -71,6 +71,114 @@ public class ExcelUtilPlus {
}
public static XSSFWorkbook genWorkbookV2WithPattern(List<List<Object>> rowList, String sheetName) {
XSSFWorkbook workbook = new XSSFWorkbook();
// 设置title样式
XSSFCellStyle titleCellStyle = workbook.createCellStyle();
XSSFFont titleFont = workbook.createFont();
titleFont.setBold(true);
titleFont.setFontName("仿宋");
titleFont.setFontHeightInPoints((short) 15);
titleCellStyle.setFont(titleFont);
titleCellStyle.setAlignment(HorizontalAlignment.CENTER);
titleCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());//背景色
titleCellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
titleCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
titleCellStyle.setBorderLeft(BorderStyle.THIN);
titleCellStyle.setBorderRight(BorderStyle.THIN);
titleCellStyle.setBorderTop(BorderStyle.THIN);
titleCellStyle.setBorderBottom(BorderStyle.THIN);
// 设置主体样式
XSSFCellStyle cellStyle = workbook.createCellStyle();
XSSFFont font = workbook.createFont();
font.setFontName("宋体");
font.setFontHeightInPoints((short) 10);// 设置字体大小
cellStyle.setFont(font);// 选择需要用到的字体格式
cellStyle.setWrapText(true);
cellStyle.setBorderLeft(BorderStyle.THIN);
cellStyle.setBorderRight(BorderStyle.THIN);
cellStyle.setBorderTop(BorderStyle.THIN);
cellStyle.setBorderBottom(BorderStyle.THIN);
XSSFSheet sheet = workbook.createSheet(sheetName);
//自适应宽度
sheet.autoSizeColumn(0, true);
//默认列宽
sheet.setDefaultColumnWidth(20);
//默认行高
sheet.setDefaultRowHeightInPoints(18);
//遍历设置列宽
List<Object> header = rowList.get(0);
List<Integer> patternList = new ArrayList<>();
XSSFRow row0 = sheet.createRow(0);
for (int i = 0; i < header.size(); i++) {
WeaTableColumnGroup columnGroupItem = (WeaTableColumnGroup) header.get(i);
XSSFCell rowZeroCell = row0.createCell(i, CellType.STRING);
rowZeroCell.setCellValue(columnGroupItem.getText().toString());
rowZeroCell.setCellStyle(titleCellStyle);
//设置列宽
sheet.setColumnWidth(i, Math.max(12, columnGroupItem.getText().length() * 4) * 256);
patternList.add(columnGroupItem.getPattern());
}
HashMap<Integer, XSSFCellStyle> numberCellStyleMap = new HashMap<Integer, XSSFCellStyle>();
XSSFDataFormat df = workbook.createDataFormat();
patternList.stream().distinct().filter(a -> a != null).forEach(p -> {
String start = "0.";
if (p == 0) {
start = "0";
}
short format = df.getFormat(start + Stream.generate(() -> "0").limit(p).collect(Collectors.joining()) + "_ ");
XSSFCellStyle numberCellStyle = workbook.createCellStyle();
BeanUtils.copyProperties(cellStyle, numberCellStyle);
numberCellStyle.setDataFormat(format);
numberCellStyleMap.put(p, numberCellStyle);
});
for (int rowIndex = 1; rowIndex < rowList.size(); rowIndex++) {
List<Object> infoList = rowList.get(rowIndex);
XSSFRow row = sheet.createRow(rowIndex);
float height = 18;
float finalHeight = 18;
for (int cellIndex = 0; cellIndex < infoList.size(); cellIndex++) {
XSSFCell cell = row.createCell(cellIndex);
if (rowIndex == 0) {
cell.setCellStyle(titleCellStyle);
} else {
cell.setCellStyle(cellStyle);
}
Object o = infoList.get(cellIndex);
if (o instanceof String) {
cell.setCellType(CellType.STRING);
cell.setCellValue(String.valueOf(o));
} else if (o instanceof BigDecimal) {
cell.setCellType(CellType.NUMERIC);
cell.setCellValue(o == null ? 0 : ((BigDecimal) o).doubleValue());
cell.setCellStyle(numberCellStyleMap.get(patternList.get(cellIndex)));
} else if (o instanceof Boolean) {
cell.setCellType(CellType.BOOLEAN);
cell.setCellValue(String.valueOf(o));
} else if (o instanceof Date) {
cell.setCellType(CellType.STRING);
cell.setCellValue(SalaryDateUtil.getFormatLocalDate((Date) o));
} else {
cell.setCellType(CellType.STRING);
cell.setCellValue(o == null ? "" : o.toString());
}
//判断是否要调整高度
int width = sheet.getColumnWidth(cellIndex) / 256;
finalHeight = getFinalHeight(o, width, finalHeight, height);
}
row.setHeightInPoints(finalHeight);
}
return workbook;
}
public static XSSFWorkbook genWorkbookV2(List<List<Object>> rowList, String sheetName) {
XSSFWorkbook workbook = new XSSFWorkbook();
@ -133,6 +241,9 @@ public class ExcelUtilPlus {
if (o instanceof String) {
cell.setCellType(CellType.STRING);
cell.setCellValue(String.valueOf(o));
} else if (o instanceof BigDecimal) {
cell.setCellType(CellType.NUMERIC);
cell.setCellValue(o == null ? 0 : ((BigDecimal) o).doubleValue());
} else if (o instanceof Boolean) {
cell.setCellType(CellType.BOOLEAN);
cell.setCellValue(String.valueOf(o));
@ -326,6 +437,9 @@ public class ExcelUtilPlus {
if (o instanceof String) {
cell.setCellType(CellType.STRING);
cell.setCellValue(String.valueOf(o));
} else if (o instanceof BigDecimal) {
cell.setCellType(CellType.NUMERIC);
cell.setCellValue(o == null ? 0 : ((BigDecimal) o).doubleValue());
} else if (o instanceof Boolean) {
cell.setCellType(CellType.BOOLEAN);
cell.setCellValue(String.valueOf(o));
@ -831,6 +945,9 @@ public class ExcelUtilPlus {
if (o instanceof String) {
cell.setCellType(CellType.STRING);
cell.setCellValue(String.valueOf(o));
} else if (o instanceof BigDecimal) {
cell.setCellType(CellType.NUMERIC);
cell.setCellValue(o == null ? 0 : ((BigDecimal) o).doubleValue());
} else if (o instanceof Boolean) {
cell.setCellType(CellType.BOOLEAN);
cell.setCellValue(String.valueOf(o));