feat: 报销模块相关功能调整

new
chenqp 1 year ago
parent f156183ad4
commit 6795c5cb50

@ -22,6 +22,7 @@ import cn.iocoder.yudao.module.bs.enums.ExpenseApplyStatusEnum;
import cn.iocoder.yudao.module.bs.enums.ExpenseClaimSettleStatusEnum;
import cn.iocoder.yudao.module.bs.service.budget.BudgetService;
import cn.iocoder.yudao.module.bs.service.feemanage.FeeManageService;
import cn.iocoder.yudao.module.bs.service.feemanage.FeeQueryReqVo;
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
@ -153,7 +154,7 @@ public class ExpenseClaimServiceImpl extends MPJBaseServiceImpl<ExpenseClaimMapp
int bb = 1;
for (ExpenseClaimDetailCreateReqVO detail : details) {
//校验是否超出费控设置
BigDecimal setAmount = feeManageService.findByClaim(detail.getFeeType(),loginUser.getId(),expenseClaim.getCostDeptId(),trip.getDestinationLocation());
BigDecimal setAmount = feeManageService.findByClaim(new FeeQueryReqVo(detail.getFeeType(), loginUser.getId(), expenseClaim.getCostDeptId(), trip.getDestinationLocation()));
if (setAmount != null && detail.getAmount().compareTo(setAmount) >0) {
return CommonResult.error("第" + aa + "条行程" + ",第" + bb + "条费用明细超出费控设置金额,费控设置金额为:" + setAmount.stripTrailingZeros().toPlainString());
}

@ -1,13 +1,16 @@
package cn.iocoder.yudao.module.bs.controller.admin.feemanage;
import cn.hutool.crypto.SecureUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.bs.controller.admin.feemanage.vo.*;
import cn.iocoder.yudao.module.bs.convert.feemanage.FeeManageConvert;
import cn.iocoder.yudao.module.bs.dal.dataobject.feemanage.FeeManageDO;
import cn.iocoder.yudao.module.bs.service.feemanage.FeeManageService;
import cn.iocoder.yudao.module.bs.service.feemanage.FeeQueryReqVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
@ -95,5 +98,11 @@ public class FeeManageController {
List<FeeManageExcelVO> datas = FeeManageConvert.INSTANCE.convertList02(list);
ExcelUtils.write(response, "费用控制.xls", "数据", FeeManageExcelVO.class, datas);
}
@GetMapping("/findByClaim")
@Operation(summary = "获取费控金额")
@PreAuthorize("@ss.hasPermission('bs:fee-manage:query')")
public CommonResult findByClaim(@Valid @RequestBody FeeQueryReqVo pageVO) {
pageVO.setUserId(SecurityFrameworkUtils.getLoginUserId());
return success(feeManageService.findByClaim(pageVO));
}
}

@ -20,7 +20,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
@ToString(callSuper = true)
public class FeeManagePageReqVO extends PageParam {
@Schema(description = "部门ID", example = "29962")
@Schema(description = "费用部门ID", example = "29962")
private Long deptId;
@Schema(description = "角色")

@ -74,5 +74,5 @@ public interface FeeManageService extends MPJBaseService<FeeManageDO> {
*/
List<FeeManageDO> getFeeManageList(FeeManageExportReqVO exportReqVO);
BigDecimal findByClaim(String feeType, Long id, Long costDeptId, String destinationLocation);
BigDecimal findByClaim(FeeQueryReqVo feeQueryReqVo);
}

@ -1,6 +1,5 @@
package cn.iocoder.yudao.module.bs.service.feemanage;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.NumberUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
@ -119,11 +118,11 @@ public class FeeManageServiceImpl extends MPJBaseServiceImpl<FeeManageMapper, Fe
}
@Override
public BigDecimal findByClaim(String feeType, Long userId, Long costDeptId, String destinationLocation) {
Set<Long> roleIds = permissionApi.getUserRoleIdListByUserId(userId);
public BigDecimal findByClaim(FeeQueryReqVo feeQueryReqVo) {
Set<Long> roleIds = permissionApi.getUserRoleIdListByUserId(feeQueryReqVo.getUserId());
BigDecimal amount = null;
for (Long roleId : roleIds) {
LambdaQueryWrapperX<FeeManageDO> queryWrapperX = getFeeManageByUniq(roleId, destinationLocation, costDeptId, feeType);
LambdaQueryWrapperX<FeeManageDO> queryWrapperX = getFeeManageByUniq(roleId, feeQueryReqVo.getDestinationLocation(), feeQueryReqVo.getCostDeptId(), feeQueryReqVo.getFeeType());
FeeManageDO feeManageDO = getOne(queryWrapperX);
if (feeManageDO !=null) {
if (amount == null) {

@ -0,0 +1,14 @@
package cn.iocoder.yudao.module.bs.service.feemanage;
import lombok.AllArgsConstructor;
import lombok.Data;
@AllArgsConstructor
@Data
public class FeeQueryReqVo {
private String feeType;
private Long userId;
private Long costDeptId;
private String destinationLocation;
}
Loading…
Cancel
Save