京贵投资二开 - 导出格式调整
This commit is contained in:
parent
879561aed4
commit
cca73dcc7a
|
|
@ -44,7 +44,7 @@ public interface SalaryStatisticsEmployeeService {
|
|||
* @param queryParam
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> listDetailPage(SalaryStatisticsEmployeeDetailResultDTO salaryStatisticsEmployeeDetailResult, SalaryStatisticsEmployeeDetailQueryParam queryParam);
|
||||
List<Map<String, Object>> listDetailPage(SalaryStatisticsEmployeeDetailResultDTO salaryStatisticsEmployeeDetailResult, SalaryStatisticsEmployeeDetailQueryParam queryParam, List<Long> needAdjustItemIds);
|
||||
|
||||
PageInfo<SalaryAcctEmployeePO> listSalaryAcctEmp(SalaryStatisticsEmployeeSalaryQueryParam queryParam);
|
||||
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ public class SalaryStatisticsEmployeeServiceImpl extends Service implements Sala
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> listDetailPage(SalaryStatisticsEmployeeDetailResultDTO salaryStatisticsEmployeeDetailResult, SalaryStatisticsEmployeeDetailQueryParam queryParam) {
|
||||
public List<Map<String, Object>> listDetailPage(SalaryStatisticsEmployeeDetailResultDTO salaryStatisticsEmployeeDetailResult, SalaryStatisticsEmployeeDetailQueryParam queryParam, List<Long> needAdjustSalaryItemIds) {
|
||||
|
||||
List<TaxAgentPO> taxAgentList = getTaxAgentService(user).listAll();
|
||||
Map<Long, String> taxAgentMap = SalaryEntityUtil.convert2Map(taxAgentList, TaxAgentPO::getId, TaxAgentPO::getName);
|
||||
|
|
@ -253,7 +253,11 @@ public class SalaryStatisticsEmployeeServiceImpl extends Service implements Sala
|
|||
acctResultValueList.forEach((k, v) -> {
|
||||
Map<String, String> map = new HashMap();
|
||||
v.forEach(l -> {
|
||||
map.put(l.getSalaryItemId() + "", l.getResultValue());
|
||||
if (needAdjustSalaryItemIds.contains(l.getSalaryItemId())) {
|
||||
map.put(l.getSalaryItemId() + "", SalaryEntityUtil.removeLastZero(l.getResultValue()));
|
||||
} else {
|
||||
map.put(l.getSalaryItemId() + "", l.getResultValue());
|
||||
}
|
||||
});
|
||||
acctResultValueMap.put(k, map);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ import org.apache.commons.collections4.CollectionUtils;
|
|||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.PageIdConst;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
|
|
@ -98,7 +99,7 @@ public class SalaryStatisticsEmployeeWrapper extends Service {
|
|||
public Map<String, Object> detailList(SalaryStatisticsEmployeeDetailQueryParam queryParam) {
|
||||
// 获取核算数据
|
||||
SalaryStatisticsEmployeeDetailResultDTO salaryStatisticsEmployeeDetailResult = getSalaryStatisticsEmployeeService(user).getDetailSalaryAcctResult(queryParam);
|
||||
List<Map<String, Object>> records = getSalaryStatisticsEmployeeService(user).listDetailPage(salaryStatisticsEmployeeDetailResult, queryParam);
|
||||
List<Map<String, Object>> records = getSalaryStatisticsEmployeeService(user).listDetailPage(salaryStatisticsEmployeeDetailResult, queryParam, Collections.emptyList());
|
||||
|
||||
Map<String, Object> countResultMap = Maps.newHashMap();
|
||||
if (CollectionUtils.isNotEmpty(records)) {
|
||||
|
|
@ -173,9 +174,21 @@ public class SalaryStatisticsEmployeeWrapper extends Service {
|
|||
}
|
||||
// 获取发薪人员
|
||||
PageInfo<SalaryAcctEmployeePO> salaryAcctEmployeePageInfo = getSalaryStatisticsEmployeeService(user).listSalaryAcctEmp(queryParam);
|
||||
// 获取需要调整格式的薪资项目信息
|
||||
BaseBean baseBean = new BaseBean();
|
||||
String itemNames = "";
|
||||
try {
|
||||
itemNames = new String(baseBean.getPropValue("jgtzSalaryAcct", "need_adjust_salary_item").getBytes("ISO-8859-1"), "UTF-8");
|
||||
} catch (Exception e) {
|
||||
baseBean.writeLog("need_adjust_salary_item转换失败");
|
||||
}
|
||||
List<String> itemNameList = Arrays.stream(itemNames.split(",")).collect(Collectors.toList());
|
||||
List<Long> needAdjustItemIds = getSalaryItemService(user).listAll().stream()
|
||||
.filter(item -> itemNameList.contains(item.getName()))
|
||||
.map(SalaryItemPO::getId).collect(Collectors.toList());
|
||||
// 获取薪资核算结果
|
||||
SalaryStatisticsEmployeeDetailResultDTO salaryStatisticsEmployeeDetailResult = getSalaryStatisticsEmployeeService(user).getDetailSalaryAcctResultByAcctEmp(salaryAcctEmployeePageInfo.getList());
|
||||
List<Map<String, Object>> records = getSalaryStatisticsEmployeeService(user).listDetailPage(salaryStatisticsEmployeeDetailResult, null);
|
||||
List<Map<String, Object>> records = getSalaryStatisticsEmployeeService(user).listDetailPage(salaryStatisticsEmployeeDetailResult, null, needAdjustItemIds);
|
||||
|
||||
PageInfo<Map<String, Object>> pageInfo = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize());
|
||||
pageInfo.setList(records);
|
||||
|
|
@ -252,7 +265,7 @@ public class SalaryStatisticsEmployeeWrapper extends Service {
|
|||
for (int i = 0; i < empParts.size(); i++) {
|
||||
// 获取薪资核算结果
|
||||
SalaryStatisticsEmployeeDetailResultDTO salaryStatisticsEmployeeDetailResult = getSalaryStatisticsEmployeeService(user).getDetailSalaryAcctResultByAcctEmp(empParts.get(i));
|
||||
List<Map<String, Object>> records = getSalaryStatisticsEmployeeService(user).listDetailPage(salaryStatisticsEmployeeDetailResult, null);
|
||||
List<Map<String, Object>> records = getSalaryStatisticsEmployeeService(user).listDetailPage(salaryStatisticsEmployeeDetailResult, null, Collections.emptyList());
|
||||
|
||||
if (CollectionUtils.isNotEmpty(records)) {
|
||||
List<SalaryItemPO> salaryItems = salaryStatisticsEmployeeDetailResult.getSalaryItemList();
|
||||
|
|
@ -304,6 +317,20 @@ public class SalaryStatisticsEmployeeWrapper extends Service {
|
|||
finalColumns.add(new WeaTableColumnGroup("100px", Util.formatMultiLang(column.getText()), column.getColumn(), "false", pattern, dataType));
|
||||
}
|
||||
});
|
||||
// 京福二开
|
||||
BaseBean baseBean = new BaseBean();
|
||||
String itemNames = "";
|
||||
try {
|
||||
itemNames = new String(baseBean.getPropValue("jgtzSalaryAcct", "need_adjust_salary_item").getBytes("ISO-8859-1"), "UTF-8");
|
||||
} catch (Exception e) {
|
||||
baseBean.writeLog("need_adjust_salary_item转换失败");
|
||||
}
|
||||
List<String> itemNameList = Arrays.stream(itemNames.split(",")).collect(Collectors.toList());
|
||||
List<String> needAdjustItems = getSalaryItemService(user).listAll().stream()
|
||||
.filter(item -> itemNameList.contains(item.getName()))
|
||||
.map(item -> item.getId() + SalaryConstant.DYNAMIC_SUFFIX)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<List<Object>> rowList = new ArrayList<>();
|
||||
// 表头
|
||||
rowList.add(finalColumns);
|
||||
|
|
@ -312,7 +339,7 @@ public class SalaryStatisticsEmployeeWrapper extends Service {
|
|||
List<Object> list = new ArrayList<>();
|
||||
for (Object column : finalColumns) {
|
||||
WeaTableColumnGroup col = (WeaTableColumnGroup) column;
|
||||
if (col.getDataType().equals(SalaryDataTypeEnum.NUMBER.getValue())) {
|
||||
if (col.getDataType().equals(SalaryDataTypeEnum.NUMBER.getValue()) && !needAdjustItems.contains(col.getColumn())) {
|
||||
try {
|
||||
list.add(new BigDecimal(Util.null2String(valueMap.get(col.getColumn()))));
|
||||
} catch (Exception e) {
|
||||
|
|
@ -329,14 +356,18 @@ public class SalaryStatisticsEmployeeWrapper extends Service {
|
|||
sumRow.add("总计");
|
||||
for (int i = 1; i < finalColumns.size(); i++) {
|
||||
WeaTableColumnGroup weaTableColumnGroup = (WeaTableColumnGroup) finalColumns.get(i);
|
||||
if (weaTableColumnGroup.getDataType().equals(SalaryDataTypeEnum.NUMBER.getValue())) {
|
||||
if (weaTableColumnGroup.getDataType().equals(SalaryDataTypeEnum.NUMBER.getValue()) && (!needAdjustItems.contains(weaTableColumnGroup.getColumn()))) {
|
||||
try {
|
||||
sumRow.add(new BigDecimal(Util.null2String(countResult.get(weaTableColumnGroup.getColumn()))));
|
||||
} catch (Exception e) {
|
||||
sumRow.add(Util.null2String(countResult.get(weaTableColumnGroup.getColumn())));
|
||||
}
|
||||
} else {
|
||||
sumRow.add(Util.null2String(countResult.get(weaTableColumnGroup.getColumn())));
|
||||
if (needAdjustItems.contains(weaTableColumnGroup.getColumn())) {
|
||||
sumRow.add(SalaryEntityUtil.removeLastZero(Util.null2String(countResult.get(weaTableColumnGroup.getColumn()))));
|
||||
} else {
|
||||
sumRow.add(Util.null2String(countResult.get(weaTableColumnGroup.getColumn())));
|
||||
}
|
||||
}
|
||||
}
|
||||
rowList.add(sumRow);
|
||||
|
|
|
|||
|
|
@ -372,5 +372,14 @@ public class SalaryEntityUtil {
|
|||
return "";
|
||||
}
|
||||
|
||||
|
||||
public static String removeLastZero(String value) {
|
||||
if (StringUtils.isBlank(value)) {
|
||||
return value;
|
||||
}
|
||||
String result = value.replaceAll("0*$", "");
|
||||
if (result.endsWith(".")) {
|
||||
result = result.substring(0, result.length() - 1);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,8 +39,8 @@ public class ExcelUtil {
|
|||
// 设置title样式
|
||||
XSSFCellStyle titleCellStyle = workbook.createCellStyle();
|
||||
XSSFFont titleFont = workbook.createFont();
|
||||
titleFont.setFontName("仿宋");
|
||||
titleFont.setFontHeightInPoints((short) 15);
|
||||
titleFont.setFontName("宋体");
|
||||
titleFont.setFontHeightInPoints((short) 10);
|
||||
titleCellStyle.setFont(titleFont);
|
||||
titleCellStyle.setAlignment(HorizontalAlignment.CENTER);
|
||||
titleCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());//背景色
|
||||
|
|
@ -88,8 +88,8 @@ public class ExcelUtil {
|
|||
// 设置title样式
|
||||
XSSFCellStyle titleCellStyle = workbook.createCellStyle();
|
||||
XSSFFont titleFont = workbook.createFont();
|
||||
titleFont.setFontName("仿宋");
|
||||
titleFont.setFontHeightInPoints((short) 15);
|
||||
titleFont.setFontName("宋体");
|
||||
titleFont.setFontHeightInPoints((short) 10);
|
||||
titleCellStyle.setFont(titleFont);
|
||||
titleCellStyle.setAlignment(HorizontalAlignment.CENTER);
|
||||
titleCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());//背景色
|
||||
|
|
@ -199,8 +199,8 @@ public class ExcelUtil {
|
|||
// 设置title样式
|
||||
XSSFCellStyle titleCellStyle = workbook.createCellStyle();
|
||||
XSSFFont titleFont = workbook.createFont();
|
||||
titleFont.setFontName("仿宋");
|
||||
titleFont.setFontHeightInPoints((short) 15);
|
||||
titleFont.setFontName("宋体");
|
||||
titleFont.setFontHeightInPoints((short) 10);
|
||||
titleCellStyle.setFont(titleFont);
|
||||
titleCellStyle.setAlignment(HorizontalAlignment.CENTER);
|
||||
titleCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());//背景色
|
||||
|
|
@ -262,8 +262,8 @@ public class ExcelUtil {
|
|||
// 设置title样式
|
||||
XSSFCellStyle titleCellStyle = workbook.createCellStyle();
|
||||
XSSFFont titleFont = workbook.createFont();
|
||||
titleFont.setFontName("仿宋");
|
||||
titleFont.setFontHeightInPoints((short) 15);
|
||||
titleFont.setFontName("宋体");
|
||||
titleFont.setFontHeightInPoints((short) 10);
|
||||
titleCellStyle.setFont(titleFont);
|
||||
titleCellStyle.setAlignment(HorizontalAlignment.CENTER);
|
||||
titleCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());//背景色
|
||||
|
|
@ -341,8 +341,8 @@ public class ExcelUtil {
|
|||
// 设置title样式
|
||||
XSSFCellStyle titleCellStyle = workbook.createCellStyle();
|
||||
XSSFFont titleFont = workbook.createFont();
|
||||
titleFont.setFontName("仿宋");
|
||||
titleFont.setFontHeightInPoints((short) 15);
|
||||
titleFont.setFontName("宋体");
|
||||
titleFont.setFontHeightInPoints((short) 10);
|
||||
titleCellStyle.setFont(titleFont);
|
||||
titleCellStyle.setAlignment(HorizontalAlignment.CENTER);
|
||||
titleCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());//背景色
|
||||
|
|
@ -409,8 +409,8 @@ public class ExcelUtil {
|
|||
// 设置title样式
|
||||
XSSFCellStyle titleCellStyle = workbook.createCellStyle();
|
||||
XSSFFont titleFont = workbook.createFont();
|
||||
titleFont.setFontName("仿宋");
|
||||
titleFont.setFontHeightInPoints((short) 15);
|
||||
titleFont.setFontName("宋体");
|
||||
titleFont.setFontHeightInPoints((short) 10);
|
||||
titleCellStyle.setFont(titleFont);
|
||||
titleCellStyle.setAlignment(HorizontalAlignment.CENTER);
|
||||
titleCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());//背景色
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ public class ExcelUtilPlus {
|
|||
// 设置title样式
|
||||
XSSFCellStyle titleCellStyle = workbook.createCellStyle();
|
||||
XSSFFont titleFont = workbook.createFont();
|
||||
titleFont.setFontName("仿宋");
|
||||
titleFont.setFontHeightInPoints((short) 15);
|
||||
titleFont.setFontName("宋体");
|
||||
titleFont.setFontHeightInPoints((short) 10);
|
||||
titleCellStyle.setFont(titleFont);
|
||||
titleCellStyle.setAlignment(HorizontalAlignment.CENTER);
|
||||
titleCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());//背景色
|
||||
|
|
@ -79,8 +79,8 @@ public class ExcelUtilPlus {
|
|||
XSSFCellStyle titleCellStyle = workbook.createCellStyle();
|
||||
XSSFFont titleFont = workbook.createFont();
|
||||
titleFont.setBold(true);
|
||||
titleFont.setFontName("仿宋");
|
||||
titleFont.setFontHeightInPoints((short) 15);
|
||||
titleFont.setFontName("宋体");
|
||||
titleFont.setFontHeightInPoints((short) 10);
|
||||
titleCellStyle.setFont(titleFont);
|
||||
titleCellStyle.setAlignment(HorizontalAlignment.CENTER);
|
||||
titleCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());//背景色
|
||||
|
|
@ -227,8 +227,8 @@ public class ExcelUtilPlus {
|
|||
XSSFCellStyle titleCellStyle = workbook.createCellStyle();
|
||||
XSSFFont titleFont = workbook.createFont();
|
||||
titleFont.setBold(true);
|
||||
titleFont.setFontName("仿宋");
|
||||
titleFont.setFontHeightInPoints((short) 15);
|
||||
titleFont.setFontName("宋体");
|
||||
titleFont.setFontHeightInPoints((short) 10);
|
||||
titleCellStyle.setFont(titleFont);
|
||||
titleCellStyle.setAlignment(HorizontalAlignment.CENTER);
|
||||
titleCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());//背景色
|
||||
|
|
@ -313,8 +313,8 @@ public class ExcelUtilPlus {
|
|||
XSSFCellStyle titleCellStyle = workbook.createCellStyle();
|
||||
XSSFFont titleFont = workbook.createFont();
|
||||
titleFont.setBold(true);
|
||||
titleFont.setFontName("仿宋");
|
||||
titleFont.setFontHeightInPoints((short) 15);
|
||||
titleFont.setFontName("宋体");
|
||||
titleFont.setFontHeightInPoints((short) 10);
|
||||
titleCellStyle.setFont(titleFont);
|
||||
titleCellStyle.setAlignment(HorizontalAlignment.CENTER);
|
||||
titleCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());//背景色
|
||||
|
|
@ -404,8 +404,8 @@ public class ExcelUtilPlus {
|
|||
XSSFCellStyle titleCellStyle = workbook.createCellStyle();
|
||||
XSSFFont titleFont = workbook.createFont();
|
||||
titleFont.setBold(true);
|
||||
titleFont.setFontName("仿宋");
|
||||
titleFont.setFontHeightInPoints((short) 15);
|
||||
titleFont.setFontName("宋体");
|
||||
titleFont.setFontHeightInPoints((short) 10);
|
||||
titleCellStyle.setFont(titleFont);
|
||||
titleCellStyle.setAlignment(HorizontalAlignment.CENTER);
|
||||
titleCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());//背景色
|
||||
|
|
@ -509,8 +509,8 @@ public class ExcelUtilPlus {
|
|||
XSSFCellStyle titleCellStyle = workbook.createCellStyle();
|
||||
XSSFFont titleFont = workbook.createFont();
|
||||
titleFont.setBold(true);
|
||||
titleFont.setFontName("仿宋");
|
||||
titleFont.setFontHeightInPoints((short) 15);
|
||||
titleFont.setFontName("宋体");
|
||||
titleFont.setFontHeightInPoints((short) 10);
|
||||
titleCellStyle.setFont(titleFont);
|
||||
titleCellStyle.setAlignment(HorizontalAlignment.CENTER);
|
||||
titleCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());//背景色
|
||||
|
|
@ -712,8 +712,8 @@ public class ExcelUtilPlus {
|
|||
XSSFCellStyle titleCellStyle = workbook.createCellStyle();
|
||||
XSSFFont titleFont = workbook.createFont();
|
||||
titleFont.setBold(true);
|
||||
titleFont.setFontName("仿宋");
|
||||
titleFont.setFontHeightInPoints((short) 15);
|
||||
titleFont.setFontName("宋体");
|
||||
titleFont.setFontHeightInPoints((short) 10);
|
||||
titleCellStyle.setFont(titleFont);
|
||||
titleCellStyle.setAlignment(HorizontalAlignment.CENTER);
|
||||
titleCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());//背景色
|
||||
|
|
|
|||
Loading…
Reference in New Issue