Merge remote-tracking branch 'origin/release/个税版本' into release/个税版本

This commit is contained in:
Harryxzy 2024-03-07 11:14:43 +08:00
commit a4f4c8c5a4
4 changed files with 45 additions and 27 deletions

View File

@ -5,6 +5,7 @@ import com.engine.salary.entity.salaryformula.po.FormulaVar;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.salarysob.po.SalarySobItemPO;
import com.engine.salary.enums.salaryformula.SalaryFormulaReferenceEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.report.common.constant.SalaryConstant;
import com.engine.salary.util.SalaryEntityUtil;
import com.google.common.collect.Lists;
@ -13,6 +14,7 @@ import org.apache.commons.lang3.StringUtils;
import java.util.*;
import java.util.concurrent.LinkedTransferQueue;
import java.util.stream.Collectors;
/**
* 对薪资核算时涉及的薪资项目进行排序
@ -25,6 +27,7 @@ import java.util.concurrent.LinkedTransferQueue;
public class SalaryCalcItemGraph {
private List<SalaryCalcItemGraphNode> nodes;
private Map<Long, String> items;
/**
* 根据薪资账套的薪资项目公式详情构建实例
@ -51,7 +54,7 @@ public class SalaryCalcItemGraph {
SalaryItemPO salaryItemPO = salaryItemMap.get(salaryItemCode);
if (salaryItemPO == null) {
continue;
}else {
} else {
subSalarySobItem = SalarySobItemPO.builder().salaryItemId(salaryItemPO.getId()).salaryItemCode(salaryItemPO.getCode()).build();
}
}
@ -63,6 +66,7 @@ public class SalaryCalcItemGraph {
}
}
this.nodes = Lists.newArrayList(nodeMap.values());
this.items = SalaryEntityUtil.convert2Map(salaryItemPOS, SalaryItemPO::getId, SalaryItemPO::getName);
}
/**
@ -130,6 +134,18 @@ public class SalaryCalcItemGraph {
// 倒序
Collections.reverse(result);
if (!Objects.equals(result.size(), nodes.size())) {
List<Long> resultIds = SalaryEntityUtil.properties(result, SalaryCalcItem::getSalaryItemId, Collectors.toList());
String errItemName = nodes.stream()
.map(SalaryCalcItemGraphNode::getSalaryCalcItem)
.map(SalaryCalcItem::getSalaryItemId)
.filter(itemId -> !resultIds.contains(itemId))
.map(itemId -> items.getOrDefault(itemId, ""))
.collect((Collectors.joining(",", "[", "]")));
throw new SalaryRunTimeException("薪资项目:" + errItemName + "存在闭环!");
}
// 返回结果列表
return result;
}

View File

@ -8,9 +8,9 @@ import com.engine.salary.biz.SalarySobItemGroupBiz;
import com.engine.salary.biz.SalarySobItemHideBiz;
import com.engine.salary.config.SalaryElogConfig;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.elog.entity.dto.LoggerContext;
import com.engine.salary.entity.salaryacct.bo.SalaryAcctCalculatePriorityBO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO;
import com.engine.salary.elog.entity.dto.LoggerContext;
import com.engine.salary.entity.salaryformula.ExpressFormula;
import com.engine.salary.entity.salaryformula.po.FormulaVar;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
@ -36,7 +36,6 @@ import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.db.IdGenerator;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.valid.ValidUtil;
import com.engine.salary.util.db.IdGenerator;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
@ -269,10 +268,6 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
// 校验
validSaveParam(saveParam);
//清除原数据
cleanOldData(salarySobId);
//保存
saveSobItem(saveParam);
@ -325,34 +320,17 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
}
/**
* 清楚原相关数据
*
* @param salarySobId
*/
private void cleanOldData(Long salarySobId) {
// 删除薪资账套的员工信息字段
// getSalarySobEmpFieldService(user).deleteBySalarySobIds(Collections.singleton(salarySobId));
// 删除薪资账套的薪资项目副本
// deleteBySalarySobIds(Collections.singleton(salarySobId));
// 删除薪资账套的薪资项目分类
// getSalarySobItemGroupService(user).deleteBySalarySobIds(Collections.singleton(salarySobId));
// 删除薪资项目是否显示
deleteItemShowBySalarySobIds(Collections.singleton(salarySobId));
}
/**
* 保存项目信息
*
* @param saveParam
*/
private void saveSobItem(SalarySobItemSaveParam saveParam) {
//处理人员信息字段
handleEmpField(saveParam);
//分组和薪资项
handleGroupAndItem(saveParam);
//处理人员信息字段
handleEmpField(saveParam);
}
private void handleGroupAndItem(SalarySobItemSaveParam saveParam) {
@ -664,6 +642,8 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
// 保存薪资账套的薪资项目副本
batchSave(salarySobItems);
// 删除原薪资项目是否显示
deleteItemShowBySalarySobIds(Collections.singleton(salarySobId));
// 保存薪资账套的薪资项目隐藏信息
batchSaveShow(needInsertItemShow);
}

View File

@ -92,6 +92,18 @@ public class SalarySobController {
return new ResponseResult<SalarySobListQueryParam, PageInfo<SalarySobListDTO>>(user).run(getSalarySobWrapper(user)::listPage, queryParam);
}
/**
* 薪资账套列表
*/
@POST
@Path("/listAll")
@Produces(MediaType.APPLICATION_JSON)
public String listAll(@Context HttpServletRequest request, @Context HttpServletResponse response) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalarySobListQueryParam, List<SalarySobPO>>(user).run(getSalarySobWrapper(user)::listAll);
}
/**
* 薪资账套基本信息表单
*/

View File

@ -94,6 +94,16 @@ public class SalarySobWrapper extends Service {
return dtoPage;
}
/**
* 薪资账套列表
*
* @return
*/
public List<SalarySobPO> listAll() {
return getSalarySobService(user).listAll();
}
private void handleSalarySobBackItemHistory(SalarySobListQueryParam queryParam) {
queryParam.setPageSize(100000);
List<SalarySobPO> list = getSalarySobService(user).listPageByParam(queryParam).getList();