diff --git a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/exception/util/ServiceExceptionUtil.java b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/exception/util/ServiceExceptionUtil.java index 7a9d62dd..0b11b4cd 100644 --- a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/exception/util/ServiceExceptionUtil.java +++ b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/exception/util/ServiceExceptionUtil.java @@ -48,7 +48,9 @@ public class ServiceExceptionUtil { String messagePattern = MESSAGES.getOrDefault(errorCode.getCode(), errorCode.getMsg()); return exception0(errorCode.getCode(), messagePattern); } - + public static ServiceException exception(String message) { + return exception0(500, message); + } public static ServiceException exception(ErrorCode errorCode, Object... params) { String messagePattern = MESSAGES.getOrDefault(errorCode.getCode(), errorCode.getMsg()); return exception0(errorCode.getCode(), messagePattern, params); diff --git a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/pojo/PageParam.java b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/pojo/PageParam.java index 77cd4372..413387f8 100644 --- a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/pojo/PageParam.java +++ b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/pojo/PageParam.java @@ -7,6 +7,8 @@ import javax.validation.constraints.Min; import javax.validation.constraints.Max; import javax.validation.constraints.NotNull; import java.io.Serializable; +import java.util.Collection; +import java.util.List; @Schema(description="分页参数") @Data @@ -26,4 +28,5 @@ public class PageParam implements Serializable { @Max(value = 1000, message = "每页条数最大值为 1000") private Integer pageSize = PAGE_SIZE; + private List sortingFields; } diff --git a/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/util/MyBatisUtils.java b/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/util/MyBatisUtils.java index 0b1b01b0..dd546e12 100644 --- a/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/util/MyBatisUtils.java +++ b/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/util/MyBatisUtils.java @@ -25,7 +25,7 @@ public class MyBatisUtils { private static final String MYSQL_ESCAPE_CHARACTER = "`"; public static Page buildPage(PageParam pageParam) { - return buildPage(pageParam, null); + return buildPage(pageParam, pageParam.getSortingFields()); } public static Page buildPage(PageParam pageParam, Collection sortingFields) { diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/expenseclaim/ExpenseClaimController.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/expenseclaim/ExpenseClaimController.java index 699df137..43bac865 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/expenseclaim/ExpenseClaimController.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/expenseclaim/ExpenseClaimController.java @@ -64,7 +64,12 @@ public class ExpenseClaimController { return expenseClaimService.createExpenseClaim(createReqVO); } - + @PostMapping("/settle") + @Operation(summary = "结算") + @PreAuthorize("@ss.hasPermission('bs:expense-claim:settle')") + public CommonResult settle(@Valid @RequestBody BillIdReqVO billIdReqVO) { + return expenseClaimService.settle(billIdReqVO); + } @DeleteMapping("/delete") @Operation(summary = "删除报销单") @Parameter(name = "id", description = "编号", required = true) diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/expenseclaim/ExpenseClaimService.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/expenseclaim/ExpenseClaimService.java index f093814b..99219a42 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/expenseclaim/ExpenseClaimService.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/expenseclaim/ExpenseClaimService.java @@ -2,10 +2,7 @@ package cn.iocoder.yudao.module.bpm.service.expenseclaim; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.bs.controller.admin.expenseclaim.vo.ExpenseClaimCreateReqVO; -import cn.iocoder.yudao.module.bs.controller.admin.expenseclaim.vo.ExpenseClaimExportReqVO; -import cn.iocoder.yudao.module.bs.controller.admin.expenseclaim.vo.ExpenseClaimPageReqVO; -import cn.iocoder.yudao.module.bs.controller.admin.expenseclaim.vo.ExpenseClaimUpdateReqVO; +import cn.iocoder.yudao.module.bs.controller.admin.expenseclaim.vo.*; import cn.iocoder.yudao.module.bs.dal.dataobject.expenseclaim.ExpenseClaimDO; import com.github.yulichang.base.MPJBaseService; @@ -75,4 +72,6 @@ public interface ExpenseClaimService extends MPJBaseService { void setDeptNameField(List toList); void processInstanceCallBack(long id, Integer result); + + CommonResult settle(BillIdReqVO billIdReqVO); } diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/expenseclaim/ExpenseClaimServiceImpl.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/expenseclaim/ExpenseClaimServiceImpl.java index 659b4b31..282d35ee 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/expenseclaim/ExpenseClaimServiceImpl.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/expenseclaim/ExpenseClaimServiceImpl.java @@ -20,6 +20,7 @@ import cn.iocoder.yudao.module.bs.dal.mysql.expenseclaim.ExpenseClaimMapper; import cn.iocoder.yudao.module.bs.enums.BillTypeEnum; 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.system.api.dept.DeptApi; import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; import cn.iocoder.yudao.module.system.api.user.AdminUserApi; @@ -63,7 +64,9 @@ public class ExpenseClaimServiceImpl extends MPJBaseServiceImpl roleIds; @Schema(description = "费用类型", requiredMode = Schema.RequiredMode.REQUIRED) @NotNull(message = "费用类型不能为空") private String feeType; @Schema(description = "限定金额", requiredMode = Schema.RequiredMode.REQUIRED) @NotNull(message = "限定金额不能为空") + @Min(value = 0, message = "限定金额需要大于等于 0") private BigDecimal amount; @Schema(description = "出差区域", requiredMode = Schema.RequiredMode.REQUIRED) - @NotNull(message = "出差区域不能为空") + @NotEmpty(message = "出差区域不能为空") private List area; @Schema(description = "备注", example = "你说的对") diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/budget/BudgetService.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/budget/BudgetService.java index 52c14160..eded8bf9 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/budget/BudgetService.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/budget/BudgetService.java @@ -1,11 +1,13 @@ package cn.iocoder.yudao.module.bs.service.budget; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.bs.controller.admin.budget.vo.BudgetCreateReqVO; import cn.iocoder.yudao.module.bs.controller.admin.budget.vo.BudgetExportReqVO; import cn.iocoder.yudao.module.bs.controller.admin.budget.vo.BudgetPageReqVO; import cn.iocoder.yudao.module.bs.controller.admin.budget.vo.BudgetUpdateReqVO; import cn.iocoder.yudao.module.bs.dal.dataobject.budget.BudgetDO; +import cn.iocoder.yudao.module.bs.dal.dataobject.expenseclaim.ExpenseClaimDO; import com.github.yulichang.base.MPJBaseService; import javax.validation.Valid; @@ -73,4 +75,5 @@ public interface BudgetService extends MPJBaseService { */ List getBudgetList(BudgetExportReqVO exportReqVO); + CommonResult updateByClaimSettle(ExpenseClaimDO claimDO); } diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/budget/BudgetServiceImpl.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/budget/BudgetServiceImpl.java index 7833351e..76e7bfa1 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/budget/BudgetServiceImpl.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/budget/BudgetServiceImpl.java @@ -1,14 +1,22 @@ package cn.iocoder.yudao.module.bs.service.budget; +import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.NumberUtil; +import cn.iocoder.yudao.framework.common.exception.ErrorCode; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.module.bs.controller.admin.budget.vo.BudgetCreateReqVO; import cn.iocoder.yudao.module.bs.controller.admin.budget.vo.BudgetExportReqVO; import cn.iocoder.yudao.module.bs.controller.admin.budget.vo.BudgetPageReqVO; import cn.iocoder.yudao.module.bs.controller.admin.budget.vo.BudgetUpdateReqVO; import cn.iocoder.yudao.module.bs.convert.budget.BudgetConvert; import cn.iocoder.yudao.module.bs.dal.dataobject.budget.BudgetDO; +import cn.iocoder.yudao.module.bs.dal.dataobject.expenseclaim.ExpenseClaimDO; import cn.iocoder.yudao.module.bs.dal.mysql.budget.BudgetMapper; import com.github.yulichang.base.MPJBaseServiceImpl; +import org.apache.commons.io.filefilter.FalseFileFilter; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; @@ -36,6 +44,7 @@ public class BudgetServiceImpl extends MPJBaseServiceImpl query = new LambdaQueryWrapperX<>(); + //根据部门和年度查找预算 + query.eq(BudgetDO::getDeptId, deptId); + query.apply("budget_year = {0}", dateTime); + BudgetDO budgetDO = getOne(query); + return budgetDO; + } } diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/feemanage/FeeManageServiceImpl.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/feemanage/FeeManageServiceImpl.java index 7bfdcb49..bf8c80b1 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/feemanage/FeeManageServiceImpl.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/feemanage/FeeManageServiceImpl.java @@ -1,6 +1,7 @@ package cn.iocoder.yudao.module.bs.service.feemanage; import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.module.bs.controller.admin.feemanage.vo.FeeManageCreateReqVO; import cn.iocoder.yudao.module.bs.controller.admin.feemanage.vo.FeeManageExportReqVO; import cn.iocoder.yudao.module.bs.controller.admin.feemanage.vo.FeeManagePageReqVO; @@ -35,17 +36,38 @@ public class FeeManageServiceImpl extends MPJBaseServiceImpl query = new LambdaQueryWrapperX<>(); + query.eq(FeeManageDO::getDeptId, feeManage.getDeptId()); + query.eq(FeeManageDO::getFeeType, feeManage.getFeeType()); + query.apply("FIND_IN_SET({0}, role_ids) > 0",roleId); + query.apply("FIND_IN_SET({0}, area) > 0",area); + if (feeManage.getId() != null) { + query.ne(FeeManageDO::getId, feeManage.getId()); + } + FeeManageDO feeManageDO = getOne(query); + if (feeManageDO != null) { + throw exception("保存失败,已存在相同费用类型、角色、区域、部门的费控配置"); + } + } + } + } + @Override public void updateFeeManage(FeeManageUpdateReqVO updateReqVO) { // 校验存在 validateFeeManageExists(updateReqVO.getId()); // 更新 FeeManageDO updateObj = FeeManageConvert.INSTANCE.convert(updateReqVO); + checkExisit(updateObj); feeManageMapper.updateById(updateObj); }