diff --git a/src/com/engine/salary/service/SalarySobItemService.java b/src/com/engine/salary/service/SalarySobItemService.java index b9d6c78db..9eeeb2424 100644 --- a/src/com/engine/salary/service/SalarySobItemService.java +++ b/src/com/engine/salary/service/SalarySobItemService.java @@ -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 itemTopology(Long salarySobId); } diff --git a/src/com/engine/salary/service/impl/SalarySobItemServiceImpl.java b/src/com/engine/salary/service/impl/SalarySobItemServiceImpl.java index def2cd40c..9b1542cc7 100644 --- a/src/com/engine/salary/service/impl/SalarySobItemServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalarySobItemServiceImpl.java @@ -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 itemTopology(Long salarySobId) { + // 3、查询薪资核算记录所用薪资账套的薪资项目副本 + List salarySobItemPOS = listBySalarySobId(salarySobId); + if (CollectionUtils.isEmpty(salarySobItemPOS)) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(99151, "当前所用的薪资账套未选择任何薪资项目,无法核算")); + } + // 4、查询当前租户的所有薪资项目 + List salaryItemPOS = getSalaryItemService(user).listAll(); + + // 8、查询公式详情 + Set formulaIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getFormulaId); + formulaIds.addAll(SalaryEntityUtil.properties(salaryItemPOS, SalaryItemPO::getFormulaId)); + List expressFormulas = getSalaryFormulaService(user).listExpressFormula(formulaIds); + // 9、计算薪资项目的运算优先级 + SalaryCalcItemGraph salaryCalcItemGraph = new SalaryCalcItemGraph(salarySobItemPOS, salaryItemPOS, expressFormulas); + List salaryCalcItems = salaryCalcItemGraph.sort(); + return salaryCalcItems; + } + + } diff --git a/src/com/engine/salary/service/impl/SalarySobServiceImpl.java b/src/com/engine/salary/service/impl/SalarySobServiceImpl.java index 20b0576be..007fb0d65 100644 --- a/src/com/engine/salary/service/impl/SalarySobServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalarySobServiceImpl.java @@ -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); diff --git a/src/com/engine/salary/web/SalarySobController.java b/src/com/engine/salary/web/SalarySobController.java index aab9889e3..a6107e4c3 100644 --- a/src/com/engine/salary/web/SalarySobController.java +++ b/src/com/engine/salary/web/SalarySobController.java @@ -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(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>(user).run(getSalarySobItemWrapper(user)::itemTopology, salarySobId); + } /**********************************薪资账套的薪资项目 end*********************************/ diff --git a/src/com/engine/salary/wrapper/SalarySobItemWrapper.java b/src/com/engine/salary/wrapper/SalarySobItemWrapper.java index 1fbe0e0e0..8b0b815e0 100644 --- a/src/com/engine/salary/wrapper/SalarySobItemWrapper.java +++ b/src/com/engine/salary/wrapper/SalarySobItemWrapper.java @@ -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 itemTopology(Long salarySobId) { + return getSalarySobItemService(user).itemTopology(salarySobId); + } } diff --git a/src/com/engine/salary/wrapper/SalarySobWrapper.java b/src/com/engine/salary/wrapper/SalarySobWrapper.java index c9f1ddd8e..7665ced9c 100644 --- a/src/com/engine/salary/wrapper/SalarySobWrapper.java +++ b/src/com/engine/salary/wrapper/SalarySobWrapper.java @@ -83,7 +83,7 @@ public class SalarySobWrapper extends Service { List taxAgentPOS = getTaxAgentService(user).listAll(); Map taxAgentIdTONameMap = SalaryEntityUtil.convert2Map(taxAgentPOS, TaxAgentPO::getId, TaxAgentPO::getName); - List salarySobListDTOS = SalarySobBO.convert2ListDTO(page.getList(),taxAgentIdTONameMap); + List salarySobListDTOS = SalarySobBO.convert2ListDTO(page.getList(), taxAgentIdTONameMap); PageInfo 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 list = getSalarySobService(user).listPageByParam(queryParam).getList(); - if(list != null && list.size()>0){ + if (list != null && list.size() > 0) { List salarySobIds = list.stream().map(SalarySobPO::getId).collect(Collectors.toList()); Long count = getSalarySobBackItemService(user).getCountBySalarySobIdIn(salarySobIds); - if(count.equals(0L)){ + if (count.equals(0L)) { // 薪资账套的默认的回算薪资项目 Set SalarySobBackItemIds = SalaryEntityUtil.properties(SalarySobBackItemBO.getDefault(), SalarySobDefaultBackItemPO::getSysSalaryItemId); // 获取薪资项目中是否已经添加回算薪资项目 @@ -118,7 +118,7 @@ public class SalarySobWrapper extends Service { List salarySobBackItems = new ArrayList<>(); // 获取默认添加后的回算薪资项目 List salaryBackItemPOS = getSalaryItemService(user).listBySysSalaryItemIds(SalarySobBackItemIds); - for(Long id : salarySobIds){ + for (Long id : salarySobIds) { for (SalarySobDefaultBackItemPO salarySobDefaultBackItemPO : SalarySobBackItemBO.getDefault()) { Date now = new Date(); Map 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 taxAgentPOS = getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId); Set taxAgentIds = SalaryEntityUtil.properties(taxAgentPOS, TaxAgentPO::getId); - return taxAgentIds.contains(salarySobPO.getTaxAgentId())||Objects.isNull(salarySobPO.getTaxAgentId()); + return taxAgentIds.contains(salarySobPO.getTaxAgentId()) || Objects.isNull(salarySobPO.getTaxAgentId()); } }