Merge remote-tracking branch 'remotes/origin/release/2.10.1.2401.01' into feature/240101工资单模板复制优化及福利基数调整记录优化
This commit is contained in:
commit
8eeb358dcc
|
|
@ -368,7 +368,8 @@ public class SalaryBillBO {
|
|||
return;
|
||||
}
|
||||
|
||||
content = content.replace("{薪资所属月}", SalaryDateUtil.getFormatYearMonth(salaryBillSendParam.getSalaryDate()));
|
||||
content = content.replace("\n", "\r\n")
|
||||
.replace("{薪资所属月}", SalaryDateUtil.getFormatYearMonth(salaryBillSendParam.getSalaryDate()));
|
||||
|
||||
for (SalaryTemplateSalaryItemListDTO item : salaryBillSendParam.getEmployeeInformation().getItems()) {
|
||||
content = content.replace("{" + item.getName() + "}", item.getSalaryItemValue());
|
||||
|
|
@ -644,7 +645,7 @@ public class SalaryBillBO {
|
|||
boolean isHide = (isHideNull && StringUtils.isEmpty(e.getOrDefault(keyName.toString(), StringUtils.EMPTY).toString()))
|
||||
||
|
||||
(isHideZero && NumberUtils.isCreatable(e.getOrDefault(keyName.toString(), "0").toString())
|
||||
&& BigDecimal.ZERO.compareTo(new BigDecimal(e.getOrDefault(keyName.toString(), "0").toString()))==0);
|
||||
&& BigDecimal.ZERO.compareTo(new BigDecimal(e.getOrDefault(keyName.toString(), "0").toString())) == 0);
|
||||
if (!isHide) {
|
||||
// 4.2.薪资项目
|
||||
emailContent.append("<th style=\"background-color:#fafafa;padding:16px 24px;color:#000000d9;font-weight:400;font-size:12px;line-height:1.5715;text-align:start;border:1px solid rgba(0,0,0,.06);min-width:100px;max-width:100px\">");
|
||||
|
|
@ -724,7 +725,7 @@ public class SalaryBillBO {
|
|||
boolean isHide = (isHideNull && StringUtils.isEmpty(e.getOrDefault(keyName.toString(), StringUtils.EMPTY).toString()))
|
||||
||
|
||||
(isHideZero && NumberUtils.isCreatable(e.getOrDefault(keyName.toString(), "0").toString())
|
||||
&& BigDecimal.ZERO.compareTo(new BigDecimal(e.getOrDefault(keyName.toString(), "0").toString()))==0);
|
||||
&& BigDecimal.ZERO.compareTo(new BigDecimal(e.getOrDefault(keyName.toString(), "0").toString())) == 0);
|
||||
if (!isHide) {
|
||||
// 4.2.薪资项目
|
||||
emailContent.append("<th style=\"background-color:#fafafa;padding:16px 24px;color:#000000d9;font-weight:400;font-size:12px;line-height:1.5715;text-align:start;border:1px solid rgba(0,0,0,.06);min-width:100px;max-width:100px\">");
|
||||
|
|
|
|||
|
|
@ -566,6 +566,9 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM
|
|||
}
|
||||
|
||||
List<TaxAgentExtRangePO> taxAgentExtRangePOS = getTaxAgentExtRangeMapper().list(TaxAgentExtRangePO.builder().taxAgentId(param.getTaxAgentId()).build());
|
||||
if(StringUtils.isNotBlank(param.getTargetName())) {
|
||||
taxAgentExtRangePOS = taxAgentExtRangePOS.stream().filter(po -> po.getTargetName().contains(param.getTargetName())).collect(Collectors.toList());
|
||||
}
|
||||
return SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), taxAgentExtRangePOS, TaxAgentExtRangePO.class);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
package com.engine.salary.util.excel;
|
||||
|
||||
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationLaborListDTO;
|
||||
import com.engine.salary.util.SalaryDateUtil;
|
||||
import com.engine.salary.util.SalaryI18nUtil;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.poi.ss.usermodel.CellType;
|
||||
import org.apache.poi.ss.usermodel.FillPatternType;
|
||||
|
|
@ -10,7 +12,12 @@ import org.apache.poi.ss.usermodel.IndexedColors;
|
|||
import org.apache.poi.xssf.usermodel.*;
|
||||
|
||||
import java.awt.*;
|
||||
import java.beans.BeanInfo;
|
||||
import java.beans.Introspector;
|
||||
import java.beans.PropertyDescriptor;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -69,6 +76,41 @@ public class ExcelUtil {
|
|||
return workbook;
|
||||
}
|
||||
|
||||
public static <T> XSSFWorkbook genWorkbook(String sheetName, List<T> rowList) {
|
||||
List<Object> headerList = Lists.newArrayList();
|
||||
List<String> dataIndexList = Lists.newArrayList();
|
||||
// 解析表头
|
||||
ExcelUtil.parseHeader(TaxDeclarationLaborListDTO.class, headerList, dataIndexList);
|
||||
|
||||
List<List<Object>> rows = new ArrayList<>();
|
||||
rows.add(headerList);
|
||||
for (int i = 0; i < rowList.size(); i++) {
|
||||
List<Object> row = Lists.newArrayListWithExpectedSize(dataIndexList.size());
|
||||
for (int j = 0; j < dataIndexList.size(); j++) {
|
||||
Object value = getValue(rowList.get(i), dataIndexList.get(j));
|
||||
row.add(value);
|
||||
}
|
||||
rows.add(row);
|
||||
}
|
||||
return genWorkbookV2(rows, sheetName);
|
||||
}
|
||||
|
||||
private static <T> Object getValue(T t, String fieldName) {
|
||||
Object value = null;
|
||||
try {
|
||||
BeanInfo beanInfo = Introspector.getBeanInfo(t.getClass());
|
||||
PropertyDescriptor[] props = beanInfo.getPropertyDescriptors();
|
||||
for (PropertyDescriptor property : props) {
|
||||
if (fieldName.equals(property.getName())) {
|
||||
Method method = property.getReadMethod();
|
||||
value = method.invoke(t, new Object[]{});
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public static XSSFWorkbook genWorkbookV2(List<List<Object>> rowList, String sheetName) {
|
||||
XSSFWorkbook workbook = new XSSFWorkbook();
|
||||
|
|
|
|||
Loading…
Reference in New Issue