美之高核算审批流程
This commit is contained in:
parent
588884150b
commit
9c0c6e7f4f
|
|
@ -335,6 +335,7 @@ public class SalaryAcctResultBO {
|
|||
// 个税扣缴义务人
|
||||
String taxAgentName = taxAgentNameMap.getOrDefault(e.getTaxAgentId(), StringUtils.EMPTY);
|
||||
map.put("taxAgentName", taxAgentName);
|
||||
map.put("taxAgentId", e.getTaxAgentId());
|
||||
// 是否属于"合并计税"的标记
|
||||
map.put("consolidatedTaxation", StringUtils.isNotEmpty(taxAgentName) && consolidatedTaxSalaryAcctEmpIds.contains(e.getId()));
|
||||
// 个税扣缴义务人的字段类型
|
||||
|
|
|
|||
|
|
@ -420,10 +420,16 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
|
|||
String DATA_TYPE_SUFFIX = "_type";
|
||||
List<List<Object>> rows = new ArrayList<>();
|
||||
rows.add(headerList);
|
||||
for (Map<String, Object> map : resultMapList) {
|
||||
List<String> redIndex = new ArrayList<>();
|
||||
for (int i =0; i < resultMapList.size(); i++) {
|
||||
Map<String, Object> map = resultMapList.get(i);
|
||||
List<Object> row = Lists.newArrayListWithExpectedSize(headerColumnGroup.size());
|
||||
for (WeaTableColumnGroup weaTableColumn : headerColumnGroup) {
|
||||
for (int j =0; j < headerColumnGroup.size(); j++) {
|
||||
WeaTableColumnGroup weaTableColumn = headerColumnGroup.get(j);
|
||||
String fieldType = (String) map.getOrDefault(weaTableColumn.getColumn().toString() + DATA_TYPE_SUFFIX, StringUtils.EMPTY);
|
||||
if (map.get(weaTableColumn.getColumn().toString() + "_color") != null) {
|
||||
redIndex.add((i+1) + ":" + j);
|
||||
}
|
||||
if (StringUtils.equals("number", fieldType) && map.get(weaTableColumn.getColumn()) != null && NumberUtil.isNumber(map.get(weaTableColumn.getColumn()).toString())) {
|
||||
row.add(new BigDecimal(StringUtils.isBlank(map.get(weaTableColumn.getColumn()).toString()) ? "0" : map.get(weaTableColumn.getColumn()).toString()));
|
||||
} else {
|
||||
|
|
@ -448,7 +454,7 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
|
|||
|
||||
String sheetName = "薪资核算结果";
|
||||
// return ExcelUtil.genWorkbookV2(rows, sheetName, total);
|
||||
return ExcelUtilPlus.genWorkbookWithChildTitleColumnWithExcelFormat(rows, sheetName, total);
|
||||
return ExcelUtilPlus.genWorkbookWithChildTitleColumnWithExcelFormat(rows, sheetName, total, redIndex);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -364,7 +364,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
|
||||
|
||||
// 查询薪资核算结果
|
||||
List<Map<String, Object>> data = listBySalaryAcctEmployees(page.getList(), queryParam);
|
||||
List<Map<String, Object>> data = listBySalaryAcctEmployees(page.getList(), queryParam, true);
|
||||
// 薪资核算结果的分页结果
|
||||
PageInfo<Map<String, Object>> resultPage = new PageInfo<>();
|
||||
resultPage.setList(data);
|
||||
|
|
@ -439,7 +439,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
// 查询薪资核算人员
|
||||
List<SalaryAcctEmployeePO> salaryAcctEmployeePOS = getSalaryAcctEmployeeService(user).listByResultQueryParam(queryParam);
|
||||
// 查询薪资核算结果
|
||||
return listBySalaryAcctEmployees(salaryAcctEmployeePOS, queryParam);
|
||||
return listBySalaryAcctEmployees(salaryAcctEmployeePOS, queryParam,true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -449,7 +449,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
* @param queryParam 列表查询条件
|
||||
* @return
|
||||
*/
|
||||
private List<Map<String, Object>> listBySalaryAcctEmployees(List<SalaryAcctEmployeePO> salaryAcctEmployeePOS, SalaryAcctResultQueryParam queryParam) {
|
||||
private List<Map<String, Object>> listBySalaryAcctEmployees(List<SalaryAcctEmployeePO> salaryAcctEmployeePOS, SalaryAcctResultQueryParam queryParam, boolean compareWithLastMonth) {
|
||||
if (CollectionUtils.isEmpty(salaryAcctEmployeePOS)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
|
@ -523,8 +523,59 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
return expressFormulaMap.getOrDefault(salarySobBackItemPO.getFormulaId(), StringUtils.EMPTY);
|
||||
});
|
||||
|
||||
if (CollectionUtils.isNotEmpty(queryParam.getSalaryItemIds())) {
|
||||
salaryItemPOS = salaryItemPOS.stream().filter(salaryItemPO -> queryParam.getSalaryItemIds().contains(salaryItemPO.getId())).collect(Collectors.toList());
|
||||
}
|
||||
List<Map<String, Object>> result = SalaryAcctResultBO.buildTableData(salaryItemPOS, salarySobEmpFieldPOS, simpleEmployees, salaryAcctEmployeePOS, salaryAcctResultPOS, taxAgentPOS, salaryAcctEmployeeIds4ConsolidatedTax, customParameters, customBackCalcParameters, queryParam.isDynamicEmpInfo());
|
||||
|
||||
|
||||
if (compareWithLastMonth) {
|
||||
// 获取需要对比的薪资项目id
|
||||
BaseBean baseBean = new BaseBean();
|
||||
List<Long> needCompareItemIds = Arrays.stream(baseBean.getPropValue("mzgSalaryReport", "need_compare_salary_item_ids").split(","))
|
||||
.filter(NumberUtils::isCreatable)
|
||||
.map(Long::valueOf)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 获取这些员工上月薪资核算结果
|
||||
Date lastMonthDate = SalaryDateUtil.localDateToDate(SalaryDateUtil.dateToLocalDate(salaryAcctRecordPO.getSalaryMonth()).minusMonths(1));
|
||||
LocalDateRange dateRange = LocalDateRange.builder().fromDate(lastMonthDate).endDate(lastMonthDate).build();
|
||||
List<SalaryAcctRecordPO> salaryAcctRecordPOS = getSalaryAcctRecordService(user).listBySalarySobIdsAndSalaryMonth(Collections.singletonList(salaryAcctRecordPO.getSalarySobId()), dateRange);
|
||||
if (CollectionUtils.isNotEmpty(salaryAcctRecordPOS)) {
|
||||
SalaryAcctRecordPO lastMonthSalaryAcctRecordPO = salaryAcctRecordPOS.get(0);
|
||||
// 获取上月薪资核算人员
|
||||
List<SalaryAcctEmployeePO> lastMonthAcctEmpList = getSalaryAcctEmployeeService(user).listBySalaryAcctRecordIdAndEmployeeIds(lastMonthSalaryAcctRecordPO.getId(), employeeIds);
|
||||
List<Long> salaryAcctEmpIds = SalaryEntityUtil.properties(lastMonthAcctEmpList, SalaryAcctEmployeePO::getId, Collectors.toList());
|
||||
|
||||
// 获取上月薪资核算结果
|
||||
List<SalaryAcctResultPO> lastMonthAcctResultList = listByAcctEmployeeIdsAndSalaryItemIds(salaryAcctEmpIds, needCompareItemIds);
|
||||
Map<String, List<SalaryAcctResultPO>> lastMonthResultMap = SalaryEntityUtil.group2Map(lastMonthAcctResultList, r -> r.getTaxAgentId() + "_" + r.getEmployeeId());
|
||||
for (Map<String, Object> map : result) {
|
||||
String taxAgentId = Utils.null2String(map.get("taxAgentId"));
|
||||
String employeeId = Utils.null2String(map.get("employeeId"));
|
||||
List<SalaryAcctResultPO> lastMonthResult = lastMonthResultMap.get(taxAgentId + "_" + employeeId);
|
||||
lastMonthResult = lastMonthResult == null ? Collections.emptyList() : lastMonthResult;
|
||||
Map<String, String> lastMonthMap = SalaryEntityUtil.convert2Map(lastMonthResult, po -> po.getSalaryItemId().toString(), SalaryAcctResultPO::getResultValue);
|
||||
for (Long compareItem : needCompareItemIds) {
|
||||
String thisValue = Utils.null2String(map.get(compareItem.toString()));
|
||||
String lastValue = Utils.null2String(lastMonthMap.get(compareItem.toString()));
|
||||
if (map.containsKey(compareItem.toString()) && !thisValue.equals(lastValue)) {
|
||||
map.put(compareItem + "_color", "red");
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (Map<String, Object> map : result) {
|
||||
for (Long compareItem : needCompareItemIds) {
|
||||
if (map.containsKey(compareItem.toString())) {
|
||||
map.put(compareItem + "_color", "red");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 转换成薪资核算结果列表
|
||||
return SalaryAcctResultBO.buildTableData(salaryItemPOS, salarySobEmpFieldPOS, simpleEmployees, salaryAcctEmployeePOS, salaryAcctResultPOS, taxAgentPOS, salaryAcctEmployeeIds4ConsolidatedTax, customParameters, customBackCalcParameters, queryParam.isDynamicEmpInfo());
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -502,7 +502,7 @@ public class ExcelUtilPlus {
|
|||
}
|
||||
|
||||
// 数值项目修改excel单元格格式为数值
|
||||
public static XSSFWorkbook genWorkbookWithChildTitleColumnWithExcelFormat(List<List<Object>> rowList, String sheetName, boolean lastRowRed) {
|
||||
public static XSSFWorkbook genWorkbookWithChildTitleColumnWithExcelFormat(List<List<Object>> rowList, String sheetName, boolean lastRowRed, List<String> redIndex) {
|
||||
XSSFWorkbook workbook = new XSSFWorkbook();
|
||||
|
||||
// 设置title样式
|
||||
|
|
@ -672,6 +672,10 @@ public class ExcelUtilPlus {
|
|||
cell.setCellStyle(cellStyle);
|
||||
}
|
||||
}
|
||||
|
||||
if (redIndex.contains(rowIndex + ":" + cellIndex)) {
|
||||
cell.setCellStyle(redCellStyle);
|
||||
}
|
||||
Object o = infoList.get(cellIndex);
|
||||
if (o instanceof String) {
|
||||
cell.setCellType(CellType.STRING);
|
||||
|
|
@ -682,6 +686,9 @@ public class ExcelUtilPlus {
|
|||
} else {
|
||||
cell.setCellStyle(numberCellStyleMap.get(patternList.get(cellIndex)));
|
||||
}
|
||||
if (redIndex.contains(rowIndex + ":" + cellIndex)) {
|
||||
cell.setCellStyle(numberRedCellStyleMap.get(patternList.get(cellIndex)));
|
||||
}
|
||||
cell.setCellType(CellType.NUMERIC);
|
||||
double value = o == null ? 0 : ((BigDecimal) o).doubleValue();
|
||||
cell.setCellValue(value);
|
||||
|
|
|
|||
|
|
@ -658,6 +658,21 @@ public class SalarySobController {
|
|||
return new ResponseResult<SalaryAcctResultQueryParam, Map<String, Object>>(user).run(getSalaryApprovalWrapper(user)::listSalaryApprovalAcctResult, param);
|
||||
}
|
||||
|
||||
/**
|
||||
* 美之高获取审批时薪资核算结果
|
||||
* @param request
|
||||
* @param response
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
@POST
|
||||
@Path("/salaryApproval/acctresult/list4detail")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String listSalaryApprovalAcctResult4Detail(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryAcctResultQueryParam param) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<SalaryAcctResultQueryParam, Map<String, Object>>(user).run(getSalaryApprovalWrapper(user)::listSalaryApprovalAcctResult4Detail, param);
|
||||
}
|
||||
|
||||
/**
|
||||
* 美之高 - 统计需要渲染到流程字段中的值
|
||||
* @param request
|
||||
|
|
|
|||
|
|
@ -26,12 +26,12 @@ import com.engine.salary.util.page.SalaryPageUtil;
|
|||
import com.engine.salary.util.valid.ValidUtil;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.hrm.User;
|
||||
import weaver.wechat.util.Utils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
@ -161,6 +161,50 @@ public class SalaryApprovalWrapper extends Service {
|
|||
return datas;
|
||||
}
|
||||
|
||||
|
||||
public Map<String, Object> listSalaryApprovalAcctResult4Detail(SalaryAcctResultQueryParam queryParam) {
|
||||
ValidUtil.doValidator(queryParam);
|
||||
// 获取需要赋值的列和的薪资项目信息
|
||||
BaseBean baseBean = new BaseBean();
|
||||
List<String> columnList = Arrays.stream(baseBean.getPropValue("mzgSalaryReport", "need_rendering_columns").split(",")).collect(Collectors.toList());
|
||||
Map<String, Long> columnItemMap = new HashMap<>();
|
||||
for (String col : columnList) {
|
||||
String itemIdStr = baseBean.getPropValue("mzgSalaryReport", col + "_detail_item_id");
|
||||
Long itemId = NumberUtils.isCreatable(itemIdStr) ? Long.valueOf(itemIdStr) : 0L;
|
||||
columnItemMap.put(col, itemId);
|
||||
}
|
||||
queryParam.setSalaryItemIds(columnItemMap.values());
|
||||
|
||||
// 查询薪资核算记录
|
||||
SalaryAcctRecordPO salaryAcctRecordPO = getSalaryAcctRecordService(user).getById(queryParam.getSalaryAcctRecordId());
|
||||
if (Objects.isNull(salaryAcctRecordPO)) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98747, "薪资核算记录不存在或已被删除"));
|
||||
}
|
||||
|
||||
// 查询薪资核算结果(分页)
|
||||
List<Map<String, Object>> acctResultList = getSalaryAcctResultService(user).listByParam(queryParam);
|
||||
List<Map<String, Object>> resultList = new ArrayList<>();
|
||||
for (Map<String, Object> map : acctResultList) {
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
for (String col : columnList) {
|
||||
Long itemId = columnItemMap.get(col);
|
||||
String value = Utils.null2String(map.get(itemId == null ? "" : itemId.toString()));
|
||||
resultMap.put(col, value);
|
||||
Object color = map.get(itemId == null ? "" : itemId.toString()+"_color");
|
||||
if (color != null) {
|
||||
resultMap.put(col+"_color", color);
|
||||
}
|
||||
}
|
||||
resultList.add(resultMap);
|
||||
}
|
||||
|
||||
Map<String, Object> datas = new HashMap<>();
|
||||
datas.put("result", resultList);
|
||||
datas.put("columns", columnItemMap.keySet());
|
||||
|
||||
return datas;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存审批流程id
|
||||
* @param saveParam
|
||||
|
|
|
|||
Loading…
Reference in New Issue