检查闭环
This commit is contained in:
parent
1d1d322188
commit
753eaa5b22
|
|
@ -185,7 +185,7 @@ public class SalaryAcctCalculatePriorityBO {
|
|||
if (Objects.equals(pre.getSalaryItemId(), current.getSalaryItemId())) {
|
||||
SalaryItemPO preSalaryItemPO = salaryItemPOMap.get(pre.getSalaryItemId());
|
||||
SalaryItemPO currentSalaryItemPO = salaryItemPOMap.get(current.getSalaryItemId());
|
||||
String errMsg = SalaryI18nUtil.getI18nLabel(101426, "{0}和{1}的公式中存在相互引用")
|
||||
String errMsg = SalaryI18nUtil.getI18nLabel(101426, "{0} {1}的公式中存在相互引用")
|
||||
.replace("{0}", Optional.ofNullable(preSalaryItemPO).map(SalaryItemPO::getName).orElse(StringUtils.EMPTY))
|
||||
.replace("{1}", Optional.ofNullable(currentSalaryItemPO).map(SalaryItemPO::getName).orElse(StringUtils.EMPTY));
|
||||
throw new SalaryRunTimeException(errMsg);
|
||||
|
|
|
|||
|
|
@ -141,4 +141,6 @@ public interface SalarySobItemService {
|
|||
* @return
|
||||
*/
|
||||
SalaryItemTopologyDTO topology(SalaryItemTopologyQueryParam param);
|
||||
|
||||
void checkLoop(Long salarySobId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ 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.SalaryAcctCalculatePriorityBO;
|
||||
import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO;
|
||||
import com.engine.salary.entity.salaryformula.ExpressFormula;
|
||||
import com.engine.salary.entity.salaryformula.po.FormulaVar;
|
||||
|
|
@ -850,6 +851,19 @@ public class SalarySobItemServiceImpl extends Service implements SalarySobItemSe
|
|||
return salaryItemTopologyDTO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkLoop(Long salarySobId) {
|
||||
// 查询薪资项目副本
|
||||
List<SalarySobItemPO> salarySobItemPOS = listBySalarySobId(salarySobId);
|
||||
// 查询薪资项目
|
||||
List<Long> salaryItemIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getSalaryItemId,Collectors.toList());
|
||||
List<SalaryItemPO> salaryItems = getSalaryItemService(user).listByIds(salaryItemIds);
|
||||
// 查询公式详情
|
||||
List<Long> formulaIds = SalaryEntityUtil.properties(salaryItems, SalaryItemPO::getFormulaId,Collectors.toList());
|
||||
List<ExpressFormula> expressFormulas = getSalaryFormulaService(user).listExpressFormula(formulaIds);
|
||||
SalaryAcctCalculatePriorityBO.calculatePriority(salarySobItemPOS,salaryItems,expressFormulas,new ArrayList<>(),new HashSet<>());
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归拓扑
|
||||
*
|
||||
|
|
|
|||
|
|
@ -401,6 +401,14 @@ public class SalarySobController {
|
|||
return new ResponseResult<SalaryItemTopologyQueryParam, SalaryItemTopologyDTO>(user).run(getSalarySobItemWrapper(user)::topology, param);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/item/checkLoop")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String checkLoop(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "salarySobId") Long salarySobId) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<Long, SalaryItemTopologyDTO>(user).run(getSalarySobItemWrapper(user)::checkLoop, salarySobId);
|
||||
}
|
||||
|
||||
|
||||
/**********************************薪资账套的薪资项目 end*********************************/
|
||||
|
||||
|
|
|
|||
|
|
@ -190,4 +190,8 @@ public class SalarySobItemWrapper extends Service {
|
|||
return getSalarySobItemService(user).topology(param);
|
||||
|
||||
}
|
||||
|
||||
public void checkLoop(Long salarySobId) {
|
||||
getSalarySobItemService(user).checkLoop(salarySobId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue