wms租赁定时任务推送到bms(把获取当前登录人的一级id改为参数传入)

This commit is contained in:
zhou-hongcheng
2026-02-26 09:36:53 +08:00
parent 2a570fbefc
commit 9621deccf1
9 changed files with 70 additions and 4 deletions
@@ -294,6 +294,12 @@ public interface SystemServiceFeign {
@GetMapping("/expenseAccountApi/getInfoByCode")
public AjaxResult getSubInfoByCode(@RequestParam("subjectCode") String subjectCode);
/**
* 根据code编码查询费用科目
*/
@GetMapping("/expenseAccountApi/getInfoByCode2")
public AjaxResult getSubInfoByCode2(@RequestParam("subjectCode") String subjectCode,@RequestParam("topOrganizationId") Long topOrganizationId);
/**
* 根据code编码查询项目信息
@@ -234,6 +234,11 @@ public class RemoteSystemFeignFallbackFactory implements FallbackFactory<SystemS
return AjaxResult.error("获取科目信息失败" + throwable.getMessage());
}
@Override
public AjaxResult getSubInfoByCode2(String subjectCode, Long topOrganizationId) {
return AjaxResult.error("获取科目信息失败" + throwable.getMessage());
}
@Override
public AjaxResult getProjectByCode(String projectCode) {
return AjaxResult.error("获取项目信息失败" + throwable.getMessage());
@@ -418,6 +418,16 @@ public class ExpenseAccountApplicationService {
return expenseAccountDomainService.getInfoByCode(subjectCode);
}
/**
* 根据编码查询费用科目信息
*/
public ExpenseAccountPO getInfoByCode2(String subjectCode,Long topOrganizationId) {
if(!StringUtils.isNotEmpty(subjectCode)){
throw new ServiceException("费用科目编码不能为空");
}
return expenseAccountDomainService.getInfoByCode2(subjectCode,topOrganizationId);
}
public List<QueryExpenseAccountPO> selectExpenseAccount(SearchExpenseAccountDO searchExpenseAccountDO){
setDataPermissionForSearch(searchExpenseAccountDO);
return expenseAccountDomainService.selectExpenseAccount(searchExpenseAccountDO);
@@ -1,5 +1,6 @@
package com.mhd.basic.domain.expenseAccount.service;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.mhd.basic.domain.expenseAccount.entity.ExpenseAccount;
import com.mhd.basic.domain.expenseAccount.repository.facade.IExpenseAccountService;
@@ -9,7 +10,10 @@ import com.mhd.basic.domain.expenseAccount.repository.todo.ExpenseAccountDO;
import com.mhd.basic.domain.expenseAccount.repository.todo.ExpenseAccountDoMap;
import com.mhd.basic.domain.expenseAccount.repository.todo.SearchExpenseAccountDO;
import com.mhd.basic.interfaces.dto.expenseAccount.SearchExpenseAccountDTO;
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
import com.mhd.common.core.exception.digitalLogisticsException.UserError;
import com.mhd.common.security.utils.SecurityUtils;
import com.mhd.system.api.model.LoginUser;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -81,11 +85,22 @@ public class ExpenseAccountDomainService {
public ExpenseAccountPO getInfoByCode(String subjectCode) {
ExpenseAccountDO expenseAccountDO = new ExpenseAccountDO();
expenseAccountDO.setSubjectCode(subjectCode);
if (SecurityUtils.getLoginUser() != null) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (!ObjectUtil.isNull(loginUser)) {
expenseAccountDO.setTopOrganizationId(SecurityUtils.getLoginUser().getUserPo().getTopOrganizationId());
}
return expenseAccountService.getInfoByCode(expenseAccountDO);
}
/**
* 根据编码查询费用科目信息
*/
public ExpenseAccountPO getInfoByCode2(String subjectCode,Long topOrganizationId) {
ExpenseAccountDO expenseAccountDO = new ExpenseAccountDO();
expenseAccountDO.setSubjectCode(subjectCode);
expenseAccountDO.setTopOrganizationId(topOrganizationId);
return expenseAccountService.getInfoByCode(expenseAccountDO);
}
public List<QueryExpenseAccountPO> selectExpenseAccount(SearchExpenseAccountDO searchExpenseAccountDO){
return expenseAccountService.selectExpenseAccount(searchExpenseAccountDO);
}
@@ -284,5 +284,13 @@ public class ExpenseAccountApi extends BaseController{
return AjaxResult.success(expenseAccountPO);
}
@ApiOperation("根据code获取费用科目")
@GetMapping(value = "/getInfoByCode2")
public AjaxResult getInfoByCode2(@RequestParam("subjectCode") String subjectCode,@RequestParam("topOrganizationId") Long topOrganizationId)
{
ExpenseAccountPO expenseAccountPO = expenseAccountApplicationService.getInfoByCode2(subjectCode,topOrganizationId);
return AjaxResult.success(expenseAccountPO);
}
}
@@ -98,7 +98,10 @@ public class CostCalculationApplicationService {
taskFlowRecordsDO.setTaskFlow(OrderSequence.getOrderCode("JFRW"));
taskFlowRecordsDO.setRequestParams(JSON.toJSONString(costCalculationDTO));
taskFlowRecordsDO.setOriginalBusinessNum(costCalculationDTO.getOriginalBusinessNum());
Boolean flag = taskFlowRecordsDomainService.saveInCost(taskFlowRecordsDO);
taskFlowRecordsDO.setTopOrganizationId(costCalculationDTO.getTopOrganizationId());
taskFlowRecordsDO.setOrganizationId(costCalculationDTO.getOrganizationId());
taskFlowRecordsDO.setOrganizationName(costCalculationDTO.getOrganizationName());
Boolean flag = taskFlowRecordsDomainService.saveInCost2(taskFlowRecordsDO);
if (!flag) {
throw new ServiceException("计费任务记录保存失败,请重试");
}
@@ -141,7 +144,7 @@ public class CostCalculationApplicationService {
throw new ServiceException("单据类型未找到");
}
//遍历费用科目取出对应配置的费用科目项
AjaxResult expenseAccountAjax = systemServiceFeign.getSubInfoByCode(costCalculationDTO.getSubjectCode());
AjaxResult expenseAccountAjax = systemServiceFeign.getSubInfoByCode2(costCalculationDTO.getSubjectCode(),costCalculationDTO.getTopOrganizationId());
if(!"200".equals(String.valueOf(ajaxResult.get("code")))) {
throw new ServiceException("费用科目不存在或已被删除");
}
@@ -304,7 +304,7 @@ public class BusinessDocumentApplicationService {
}
//根据费用科目code查询费用信息,并赋值
if(StringUtils.isNotEmpty(businessDocumentDO.getSecondSubjectCode())){
AjaxResult ajaxResult = systemServiceFeign.getSubInfoByCode(businessDocumentDO.getSecondSubjectCode());
AjaxResult ajaxResult = systemServiceFeign.getSubInfoByCode2(businessDocumentDO.getSecondSubjectCode(),businessDocumentDO.getTopOrganizationId());
if("200".equals(String.valueOf(ajaxResult.get("code")))){
ExpenseAccountPO expenseAccountPO = JSON.parseObject(com.alibaba.fastjson2.JSONObject.toJSONString(ajaxResult.get("data")), ExpenseAccountPO.class);
if(null == expenseAccountPO || expenseAccountPO.getExpenseAccountId()==null){
@@ -826,6 +826,8 @@ public class BusinessDocumentApplicationService {
costCalculationDTO.setSubjectCode(StringUtils.isEmpty(businessDocumentDO.getSecondSubjectCode()) ? businessDocumentDO.getFirstSubjectCode():businessDocumentDO.getSecondSubjectCode());
costCalculationDTO.setDocumentTypeCode(businessDocumentDO.getDocumentTypeCode());
costCalculationDTO.setTopOrganizationId(businessDocumentDO.getTopOrganizationId());
costCalculationDTO.setOrganizationId(businessDocumentDO.getOrganizationId());
costCalculationDTO.setOrganizationName(businessDocumentDO.getOrganizationName());
BillingCostPo billingCostPo = costCalculationApplicationService.costCalculation(costCalculationDTO);
businessDocumentDO.setEstimatedCost(billingCostPo.getComputationalCost());
businessDocumentDO.setBillAmount(billingCostPo.getComputationalCost());//计费金额与计算金额一致
@@ -83,4 +83,15 @@ public class TaskFlowRecordsDomainService {
taskFlowRecordsDO.setCreateTime(new Date());
return taskFlowRecordsService.insert(taskFlowRecordsDO);
}
/**
* 保存任务流水
*/
public Boolean saveInCost2(TaskFlowRecordsDO taskFlowRecordsDO) {
taskFlowRecordsDO.setTopOrganizationId(taskFlowRecordsDO.getTopOrganizationId());
taskFlowRecordsDO.setOrganizationId(taskFlowRecordsDO.getOrganizationId());
taskFlowRecordsDO.setOrganizationName(taskFlowRecordsDO.getOrganizationName());
taskFlowRecordsDO.setCreateTime(new Date());
return taskFlowRecordsService.insert(taskFlowRecordsDO);
}
}
@@ -40,6 +40,12 @@ public class CostCalculationDTO{
@Excel(name = "一级组织表ID")
private Long topOrganizationId;
@ApiModelProperty("组织表ID")
private Long organizationId;
@ApiModelProperty("组织名称")
private String organizationName;