账套拓扑图

This commit is contained in:
钱涛 2023-10-16 10:45:19 +08:00
parent 5d3e2928c9
commit 895d3065e9
6 changed files with 63 additions and 7 deletions

View File

@ -1,5 +1,6 @@
package com.engine.salary.service;
import com.engine.salary.entity.salaryacct.bo.SalaryCalcItem;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.salarysob.dto.SalarySobItemAggregateDTO;
import com.engine.salary.entity.salarysob.dto.SalarySobItemFormDTO;
@ -128,4 +129,6 @@ public interface SalarySobItemService {
SalarySobItemFormDTO getSalaryItemForm(SalarySobItemPO param);
void update(SalarySobItemPO po);
List<SalaryCalcItem> itemTopology(Long salarySobId);
}

View File

@ -7,6 +7,8 @@ import com.engine.salary.biz.SalarySobItemBiz;
import com.engine.salary.biz.SalarySobItemGroupBiz;
import com.engine.salary.biz.SalarySobItemHideBiz;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.entity.salaryacct.bo.SalaryCalcItem;
import com.engine.salary.entity.salaryacct.bo.SalaryCalcItemGraph;
import com.engine.salary.entity.salaryformula.ExpressFormula;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.salarysob.bo.SalarySobItemAggregateBO;
@ -799,4 +801,26 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
return salarySobItemFormDTO;
}
@Override
public List<SalaryCalcItem> itemTopology(Long salarySobId) {
// 3查询薪资核算记录所用薪资账套的薪资项目副本
List<SalarySobItemPO> salarySobItemPOS = listBySalarySobId(salarySobId);
if (CollectionUtils.isEmpty(salarySobItemPOS)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(99151, "当前所用的薪资账套未选择任何薪资项目,无法核算"));
}
// 4查询当前租户的所有薪资项目
List<SalaryItemPO> salaryItemPOS = getSalaryItemService(user).listAll();
// 8查询公式详情
Set<Long> formulaIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getFormulaId);
formulaIds.addAll(SalaryEntityUtil.properties(salaryItemPOS, SalaryItemPO::getFormulaId));
List<ExpressFormula> expressFormulas = getSalaryFormulaService(user).listExpressFormula(formulaIds);
// 9计算薪资项目的运算优先级
SalaryCalcItemGraph salaryCalcItemGraph = new SalaryCalcItemGraph(salarySobItemPOS, salaryItemPOS, expressFormulas);
List<SalaryCalcItem> salaryCalcItems = salaryCalcItemGraph.sort();
return salaryCalcItems;
}
}

View File

@ -122,6 +122,14 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
return ServiceUtil.getService(TaxAgentManageRangeServiceImpl.class, user);
}
private SalarySobItemService getSalarySobItemService(User user) {
return ServiceUtil.getService(SalarySobItemServiceImpl.class, user);
}
private SalaryFormulaService getSalaryFormulaService(User user) {
return ServiceUtil.getService(SalaryFormulaServiceImpl.class, user);
}
private SalarySobBackItemService getSalarySobBackItemService(User user) {
return ServiceUtil.getService(SalarySobBackItemServiceImpl.class, user);
}
@ -146,6 +154,7 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
return ServiceUtil.getService(SalarySobTaxReportRuleServiceImpl.class, user);
}
@Override
public SalarySobPO getById(Long id) {
return salarySobMapper.getById(id);

View File

@ -2,6 +2,7 @@ package com.engine.salary.web;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.SalarySobExtRangePO;
import com.engine.salary.entity.salaryacct.bo.SalaryCalcItem;
import com.engine.salary.entity.salaryitem.dto.SalaryItemSobListDTO;
import com.engine.salary.entity.salaryitem.param.SalaryItemSearchParam;
import com.engine.salary.entity.salarysob.dto.*;
@ -385,6 +386,20 @@ public class SalarySobController {
return new ResponseResult<SalarySobItemPO, SalarySobItemFormDTO>(user).run(getSalarySobItemWrapper(user)::getSalaryItemForm, param);
}
/**
* 账套项目拓扑图
* @param request
* @param response
* @param salarySobId
* @return
*/
@GET
@Path("/item/topology")
@Produces(MediaType.APPLICATION_JSON)
public String getSalaryItemForm(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "salarySobId") Long salarySobId) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Long, List<SalaryCalcItem>>(user).run(getSalarySobItemWrapper(user)::itemTopology, salarySobId);
}
/**********************************薪资账套的薪资项目 end*********************************/

View File

@ -3,6 +3,7 @@ package com.engine.salary.wrapper;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.annotation.SalaryFormulaVar;
import com.engine.salary.entity.salaryacct.bo.SalaryCalcItem;
import com.engine.salary.entity.salaryformula.ExpressFormula;
import com.engine.salary.entity.salaryformula.dto.SalaryFormulaEmployeeDTO;
import com.engine.salary.entity.salaryitem.bo.SalaryItemBO;
@ -177,4 +178,8 @@ public class SalarySobItemWrapper extends Service {
public SalarySobItemFormDTO getSalaryItemForm(SalarySobItemPO param) {
return getSalarySobItemService(user).getSalaryItemForm(param);
}
public List<SalaryCalcItem> itemTopology(Long salarySobId) {
return getSalarySobItemService(user).itemTopology(salarySobId);
}
}

View File

@ -83,7 +83,7 @@ public class SalarySobWrapper extends Service {
List<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listAll();
Map<Long, String> taxAgentIdTONameMap = SalaryEntityUtil.convert2Map(taxAgentPOS, TaxAgentPO::getId, TaxAgentPO::getName);
List<SalarySobListDTO> salarySobListDTOS = SalarySobBO.convert2ListDTO(page.getList(),taxAgentIdTONameMap);
List<SalarySobListDTO> salarySobListDTOS = SalarySobBO.convert2ListDTO(page.getList(), taxAgentIdTONameMap);
PageInfo<SalarySobListDTO> dtoPage = new PageInfo<>(salarySobListDTOS, SalarySobListDTO.class);
dtoPage.setTotal(page.getTotal());
dtoPage.setPageNum(page.getPageNum());
@ -97,10 +97,10 @@ public class SalarySobWrapper extends Service {
private void handleSalarySobBackItemHistory(SalarySobListQueryParam queryParam) {
queryParam.setPageSize(100000);
List<SalarySobPO> list = getSalarySobService(user).listPageByParam(queryParam).getList();
if(list != null && list.size()>0){
if (list != null && list.size() > 0) {
List<Long> salarySobIds = list.stream().map(SalarySobPO::getId).collect(Collectors.toList());
Long count = getSalarySobBackItemService(user).getCountBySalarySobIdIn(salarySobIds);
if(count.equals(0L)){
if (count.equals(0L)) {
// 薪资账套的默认的回算薪资项目
Set<Long> SalarySobBackItemIds = SalaryEntityUtil.properties(SalarySobBackItemBO.getDefault(), SalarySobDefaultBackItemPO::getSysSalaryItemId);
// 获取薪资项目中是否已经添加回算薪资项目
@ -118,7 +118,7 @@ public class SalarySobWrapper extends Service {
List<SalarySobBackItemPO> salarySobBackItems = new ArrayList<>();
// 获取默认添加后的回算薪资项目
List<SalaryItemPO> salaryBackItemPOS = getSalaryItemService(user).listBySysSalaryItemIds(SalarySobBackItemIds);
for(Long id : salarySobIds){
for (Long id : salarySobIds) {
for (SalarySobDefaultBackItemPO salarySobDefaultBackItemPO : SalarySobBackItemBO.getDefault()) {
Date now = new Date();
Map<Long, SalaryItemPO> sysSalaryItemMap = SalaryEntityUtil.convert2Map(salaryBackItemPOS, SalaryItemPO::getSysSalaryItemId);
@ -134,7 +134,7 @@ public class SalarySobWrapper extends Service {
.valueType(salaryItemPO.getValueType())
.formulaId(salarySobDefaultBackItemPO.getFormulaId())
.backCalcType(salarySobDefaultBackItemPO.getBackCalcType())
.creator((long)user.getUID())
.creator((long) user.getUID())
.createTime(now)
.updateTime(now)
.deleteType(DeleteTypeEnum.NOT_DELETED.getValue())
@ -174,7 +174,7 @@ public class SalarySobWrapper extends Service {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98379, "参数错误,薪资账套不存在或者已被删除"));
}
// 薪资装套po转换成薪资账套详情dto
basicForm = SalarySobBO.convert2FormDTO(basicForm,salarySobPO);
basicForm = SalarySobBO.convert2FormDTO(basicForm, salarySobPO);
}
// 转换成前端所需的数据格式
data.put("basicForm", basicForm);
@ -251,7 +251,7 @@ public class SalarySobWrapper extends Service {
Collection<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId);
Set<Long> taxAgentIds = SalaryEntityUtil.properties(taxAgentPOS, TaxAgentPO::getId);
return taxAgentIds.contains(salarySobPO.getTaxAgentId())||Objects.isNull(salarySobPO.getTaxAgentId());
return taxAgentIds.contains(salarySobPO.getTaxAgentId()) || Objects.isNull(salarySobPO.getTaxAgentId());
}
}