Compare commits

...

5 Commits

Author SHA1 Message Date
furongxin
79644208cc 临时修改 放开项目查询权限,用于处理之前的数据 2025-01-09 15:30:06 +08:00
furongxin
b9229cfc2d refactor(bpm): 移除未使用的代码导入和冗余代码
- 删除了 BpmOAPaymentController 中未使用的导入语句
- 删除了 BpmProcessInstanceServiceImpl 中未使用的导入语句和冗余代码
2025-01-09 10:10:48 +08:00
furongxin
0e8ca79912 refactor(system): 优化部门信息获取功能
- 修改了 DeptService 接口,增加了 method 参数以
2025-01-09 10:10:16 +08:00
furongxin
1fcb34677e refactor(bpm): 重构报销、现金支出和付款业务的打印数据处理逻辑
- 新增 BpmOAPrintDataRespVO 类统一报销、现金支出和付款业务的打印数据结构
- 新增 BpmProcessInstancePrintDataRespVO 类用于流程实例的打印数据响应
- 重构 BpmOAPaymentController 和 BpmOAPaymentService 接口,将业务逻辑移至服务层
- 优化 BpmProcessInstanceServiceImpl 中的打印数据处理逻辑,支持多种业务类型
2025-01-09 10:10:04 +08:00
furongxin
a182bef370 feat(system): 增加用户银行卡信息查询接口并优化相关功能
- 在 UserBankController 中添加 getUserBankPage 方法,实现用户银行卡信息的分页查询
- 在 UserBankRespVO 中增加 creator 和 createName 字段,用于展示创建人信息
- 在 UserBankServiceImpl 中优化 createBank 方法,增加对银行卡号和昵称的联合查询
- 新增 userService 依赖,用于获取用户信息
2025-01-08 09:26:29 +08:00
16 changed files with 141 additions and 120 deletions

View File

@ -9,18 +9,13 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.payment.*;
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAPaymentDO;
import cn.iocoder.yudao.module.bpm.service.oa.BpmOAPaymentService;
import cn.iocoder.yudao.module.system.api.bank.BankApi;
import cn.iocoder.yudao.module.system.api.bank.dto.BankRespDTO;
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.project.ProjectApi;
import cn.iocoder.yudao.module.system.api.project.dto.ProjectDTO;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.commons.lang3.StringUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -49,18 +44,12 @@ public class BpmOAPaymentController {
@Resource
private BpmOAPaymentService paymentService;
@Resource
private ProjectApi projectApi;
@Resource
private AdminUserApi userApi;
@Resource
private DeptApi deptApi;
@Resource
private BankApi bankApi;
@PostMapping("/create")
@Operation(summary = "创建付款申请")
public CommonResult<Long> createPayment(@Valid @RequestBody BpmOAPaymentCreateReqVO createReqVO) {
@ -74,44 +63,7 @@ public class BpmOAPaymentController {
public CommonResult<BpmOAPaymentRespVO> getPayment(@RequestParam("id") Long id) {
BpmOAPaymentDO payment = paymentService.getPayment(id);
BpmOAPaymentRespVO respVO = BeanUtils.toBean(payment, BpmOAPaymentRespVO.class);
if (respVO != null) {
// 获取部门信息Map
List<Long> deptIds = new ArrayList<>();
if (CollectionUtil.isNotEmpty(respVO.getFactoryDetail())) {
deptIds.addAll(convertList(respVO.getFactoryDetail(), FactoryDetailVO::getDeptId));
}else {
deptIds.add(payment.getDeptId());
}
deptIds.add(payment.getPaymentCompany());
Map<Long, DeptRespDTO> dtoMap = deptApi.getDeptMap(new HashSet<>(deptIds));
// 设置部门名称
respVO.setDeptName(dtoMap.get(payment.getDeptId()) != null ? dtoMap.get(payment.getDeptId()).getName() : null);
// 设置付款公司名称
respVO.setPaymentCompanyName(dtoMap.get(payment.getPaymentCompany()).getName());
// 设置工厂名称
respVO.getFactoryDetail().forEach(item -> {
item.setFactoryName(dtoMap.get(item.getDeptId()).getName());
});
if (StringUtils.isNotEmpty(payment.getProjectNo())) {
// 获取项目信息
ProjectDTO project = projectApi.getProject(payment.getProjectNo()).getCheckedData();
// 设置项目名称
respVO.setProjectName(project.getName());
}
if (payment.getBankId() != null) {
// 获取银行卡信息
BankRespDTO bankResp = bankApi.getBank(payment.getBankId()).getCheckedData();
// 设置银行卡信息
respVO.setBankName(bankResp.getBankName());
respVO.setBankNo(bankResp.getBankNo());
respVO.setNickname(bankResp.getNickname());
}
}
BpmOAPaymentRespVO respVO = paymentService.convertPayment(payment);
return success(respVO);
}
@ -122,43 +74,7 @@ public class BpmOAPaymentController {
public CommonResult<BpmOAPaymentRespVO> getByProcessInstanceId(@RequestParam("processInstanceId") String processInstanceId) {
BpmOAPaymentDO payment = paymentService.getByProcessInstanceId(processInstanceId);
BpmOAPaymentRespVO respVO = BeanUtils.toBean(payment, BpmOAPaymentRespVO.class);
if (respVO != null) {
// 获取部门信息Map
List<Long> deptIds = new ArrayList<>();
if (CollectionUtil.isNotEmpty(respVO.getFactoryDetail())) {
deptIds.addAll(convertList(respVO.getFactoryDetail(), FactoryDetailVO::getDeptId));
}else {
deptIds.add(payment.getDeptId());
}
deptIds.add(payment.getPaymentCompany());
Map<Long, DeptRespDTO> dtoMap = deptApi.getDeptMap(new HashSet<>(deptIds));
// 设置部门名称
respVO.setDeptName(dtoMap.get(payment.getDeptId()) != null ? dtoMap.get(payment.getDeptId()).getName() : null);
// 设置付款公司名称
respVO.setPaymentCompanyName(dtoMap.get(payment.getPaymentCompany()).getName());
// 设置工厂名称
respVO.getFactoryDetail().forEach(item -> {
item.setFactoryName(dtoMap.get(item.getDeptId()).getName());
});
if (payment.getProjectNo() != null) {
// 获取项目信息
ProjectDTO project = projectApi.getProject(payment.getProjectNo()).getCheckedData();
// 设置项目名称
respVO.setProjectName(project.getName());
}
if (payment.getBankId() != null) {
// 获取银行卡信息
BankRespDTO bankResp = bankApi.getBank(payment.getBankId()).getCheckedData();
// 设置银行卡信息
respVO.setBankName(bankResp.getBankName());
respVO.setBankNo(bankResp.getBankNo());
respVO.setNickname(bankResp.getNickname());
}
}
BpmOAPaymentRespVO respVO = paymentService.convertPayment(payment);
return success(respVO);
}

View File

@ -1,6 +1,8 @@
package cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.print;
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.BpmOABaseRespVO;
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.cash.BpmOACashRespVO;
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.payment.BpmOAPaymentRespVO;
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.reimbursement.BpmOAReimbursementRespVO;
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.BpmTaskRespVO;
import io.swagger.v3.oas.annotations.media.Schema;
@ -14,12 +16,18 @@ import java.util.List;
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class BpmOAReimbursementPrintDataRespVO extends BpmOABaseRespVO {
public class BpmOAPrintDataRespVO extends BpmOABaseRespVO {
@Schema(description = "报销业务数据", requiredMode = Schema.RequiredMode.REQUIRED)
@Schema(description = "报销业务数据")
private BpmOAReimbursementRespVO bpmOAReimbursementRespVO ;
@Schema(description = "流程审批节点信息【包含人员签名地址】", requiredMode = Schema.RequiredMode.REQUIRED)
@Schema(description = "现金支出业务数据")
private BpmOACashRespVO bpmOACashRespVO;
@Schema(description = "付款业务数据")
private BpmOAPaymentRespVO bpmOAPaymentRespVO;
@Schema(description = "流程审批节点信息【包含人员签名地址】")
List<BpmTaskRespVO> processTasks ;
/**

View File

@ -15,9 +15,9 @@ public class BpmProcessInstancePrintDataRespVO {
@Schema(description = "流程标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "oa_reimbursement")
private String key;
@Schema(description = "报销业务打印数据", requiredMode = Schema.RequiredMode.REQUIRED)
private BpmOAReimbursementPrintDataRespVO bpmOAReimbursementPrintDataRespVO ;
@Schema(description = "业务打印数据", requiredMode = Schema.RequiredMode.REQUIRED)
private BpmOAPrintDataRespVO printDataRespVO ;
@Schema(description = "现金支出业务打印数据", requiredMode = Schema.RequiredMode.REQUIRED)
private BpmOACashPrintDataRespVO bpmOACashPrintDataRespVO;
// @Schema(description = "现金支出业务打印数据", requiredMode = Schema.RequiredMode.REQUIRED)
// private BpmOACashPrintDataRespVO bpmOACashPrintDataRespVO;
}

View File

@ -77,4 +77,6 @@ public interface BpmOAPaymentService {
* @param url utl
*/
void deleteFiles(Long id, String url);
BpmOAPaymentRespVO convertPayment(BpmOAPaymentDO payment);
}

View File

@ -1,15 +1,13 @@
package cn.iocoder.yudao.module.bpm.service.oa;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.UploadUserFile;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.payment.BpmOAPaymentCreateReqVO;
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.payment.BpmOAPaymentPageReqVO;
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.payment.BpmOAPaymentRespVO;
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.payment.BpmOAPaymentUpdateReqVO;
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.payment.*;
import cn.iocoder.yudao.module.bpm.dal.dataobject.financialpayment.FinancialPaymentDO;
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAPaymentDO;
import cn.iocoder.yudao.module.bpm.dal.dataobject.task.BpmProcessInstanceExtDO;
@ -18,19 +16,24 @@ import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum;
import cn.iocoder.yudao.module.bpm.service.financialpayment.FinancialPaymentService;
import cn.iocoder.yudao.module.bpm.service.task.BpmHistoryProcessInstanceService;
import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
import cn.iocoder.yudao.module.system.api.bank.BankApi;
import cn.iocoder.yudao.module.system.api.bank.dto.BankRespDTO;
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.project.ProjectApi;
import cn.iocoder.yudao.module.system.api.project.dto.ProjectDTO;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import org.apache.commons.lang3.StringUtils;
import org.flowable.engine.runtime.ProcessInstance;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.OA_PAYMENT_FILES_NOT_NULL;
import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.OA_PAYMENT_NOT_EXISTS;
@ -63,6 +66,15 @@ public class BpmOAPaymentServiceImpl extends BpmOABaseService implements BpmOAPa
@Resource
private AdminUserApi userApi;
@Resource
private DeptApi deptApi;
@Resource
private BankApi bankApi;
@Resource
private ProjectApi projectApi;
@Override
public Long createPayment(Long userId, BpmOAPaymentCreateReqVO createReqVO) {
@ -204,6 +216,50 @@ public class BpmOAPaymentServiceImpl extends BpmOABaseService implements BpmOAPa
}
}
@Override
public BpmOAPaymentRespVO convertPayment(BpmOAPaymentDO payment) {
BpmOAPaymentRespVO respVO = BeanUtils.toBean(payment, BpmOAPaymentRespVO.class);
if (respVO != null) {
// 获取部门信息Map
List<Long> deptIds = new ArrayList<>();
if (CollectionUtil.isNotEmpty(respVO.getFactoryDetail())) {
deptIds.addAll(convertList(respVO.getFactoryDetail(), FactoryDetailVO::getDeptId));
}else {
deptIds.add(payment.getDeptId());
}
deptIds.add(payment.getPaymentCompany());
Map<Long, DeptRespDTO> dtoMap = deptApi.getDeptMap(new HashSet<>(deptIds));
// 设置部门名称
respVO.setDeptName(dtoMap.get(payment.getDeptId()) != null ? dtoMap.get(payment.getDeptId()).getName() : null);
// 设置付款公司名称
respVO.setPaymentCompanyName(dtoMap.get(payment.getPaymentCompany()).getName());
// 设置工厂名称
respVO.getFactoryDetail().forEach(item -> {
item.setFactoryName(dtoMap.get(item.getDeptId()).getName());
});
if (StringUtils.isNotEmpty(payment.getProjectNo())) {
// 获取项目信息
ProjectDTO project = projectApi.getProject(payment.getProjectNo()).getCheckedData();
// 设置项目名称
respVO.setProjectName(project.getName());
}
if (payment.getBankId() != null) {
// 获取银行卡信息
BankRespDTO bankResp = bankApi.getBank(payment.getBankId()).getCheckedData();
// 设置银行卡信息
respVO.setBankName(bankResp.getBankName());
respVO.setBankNo(bankResp.getBankNo());
respVO.setNickname(bankResp.getNickname());
}
}
return respVO;
}
private BpmOAPaymentDO validateLeaveExists(Long id) {
BpmOAPaymentDO paymentDO = paymentMapper.selectById(id);
if (paymentDO == null) {

View File

@ -132,7 +132,7 @@ public class DeptApiImpl implements DeptApi {
@Override
@DataPermission(enable = false)
public CommonResult<List<DeptRespDTO>> getCompanyDept() {
List<DeptDO> deptDOS = deptService.getCompanyDept();
List<DeptDO> deptDOS = deptService.getCompanyDept(2);
return success(BeanUtils.toBean(deptDOS, DeptRespDTO.class));
}

View File

@ -7,7 +7,9 @@ import cn.iocoder.yudao.module.system.controller.admin.bank.vo.UserBankPageReqVO
import cn.iocoder.yudao.module.system.controller.admin.bank.vo.UserBankRespVO;
import cn.iocoder.yudao.module.system.controller.admin.bank.vo.UserBankSaveReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.bank.BankDO;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import cn.iocoder.yudao.module.system.service.bank.UserBankService;
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
@ -18,6 +20,10 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
@ -31,6 +37,9 @@ public class UserBankController {
@Resource
private UserBankService userBankService;
@Resource
private AdminUserService userService;
@PostMapping("/create")
@Operation(summary = "创建银行卡信息")
@PreAuthorize("@ss.hasPermission('system:user-bank:create')")
@ -107,15 +116,33 @@ public class UserBankController {
@PreAuthorize("@ss.hasPermission('system:user-bank:query')")
public CommonResult<PageResult<UserBankRespVO>> getUserBankPage(@Valid UserBankPageReqVO pageReqVO) {
PageResult<BankDO> pageResult = new PageResult<BankDO>();
List<Long> bankIds = userBankService.getBankIds(getLoginUserId());
if (!bankIds.isEmpty()) {
if (bankIds.isEmpty()) {
pageResult = userBankService.getBankPageIn(pageReqVO, bankIds);
return success(PageResult.empty());
}
PageResult<BankDO> pageResult = userBankService.getBankPageIn(pageReqVO, bankIds);
return success(BeanUtils.toBean(pageResult, UserBankRespVO.class));
// 获取创建者信息
Set<Long> userIds = pageResult.getList().stream()
.filter(Objects::nonNull)
.map(BankDO::getCreator)
.map(Long::valueOf)
.collect(Collectors.toSet());
List<AdminUserDO> userDOS = userService.getUserList(userIds);
Map<String, AdminUserDO> userMap = userDOS.stream()
.collect(Collectors.toMap(user ->
String.valueOf(user.getId()), // Long 类型的 id 转换为 String 类型
v -> v));
PageResult<UserBankRespVO> respResult = BeanUtils.toBean(pageResult, UserBankRespVO.class);
respResult.getList().forEach(item -> {
// 设置创建者名称
item.setCreateName(userMap.get(item.getCreator()) != null ? userMap.get(item.getCreator()).getNickname() : "");
});
return success(respResult);
}
@GetMapping("/list")

View File

@ -35,4 +35,10 @@ public class UserBankRespVO {
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@Schema(description = "创建人", example = "1")
private String creator;
@Schema(description = "创建人名称", example = "赵六")
private String createName;
}

View File

@ -271,9 +271,10 @@ public class DeptController {
@GetMapping("/getCompanyDept")
@Operation(summary = "获取部门类型为公司的部门信息")
@Parameter(name = "method", description = "查询类型 | 1全部 2真实公司 3隐藏公司")
@DataPermission(enable = false)
public CommonResult<List<DeptSimpleRespVO>> getCompanyDept() {
List<DeptDO> list = deptService.getCompanyDept();
public CommonResult<List<DeptSimpleRespVO>> getCompanyDept(@RequestParam(name = "method", required = false, defaultValue = "2") Integer method) {
List<DeptDO> list = deptService.getCompanyDept(method);
return success(BeanUtils.toBean(list, DeptSimpleRespVO.class));
}

View File

@ -75,7 +75,7 @@ public class AttendancePunchRecordController {
@GetMapping("/getMissingCardRecord")
@Operation(summary = "获得本月用户缺卡记录")
@PreAuthorize("@ss.hasPermission('attendance:punch-record:query')")
// @PreAuthorize("@ss.hasPermission('attendance:punch-record:query')")
public CommonResult<List<AttendancePunchRecordRespVO>> getPunchRecord() {
// 获取当前用户已申请的补卡记录

View File

@ -178,7 +178,7 @@ public class LogInstanceController {
public CommonResult<List<DeptRespVO>> getReadCompanyDept() {
// 获得公司编号列表
List<DeptDO> companyDeptDOs = deptService.getCompanyDept();
List<DeptDO> companyDeptDOs = deptService.getCompanyDept(2);
// 获得用户角色
List<RoleDO> userRoles = roleService.getRoleListFromCache(permissionService.getUserRoleIdListByUserId(getLoginUserId()));

View File

@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.system.service.bank;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.system.controller.admin.bank.vo.UserBankPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.bank.vo.UserBankSaveReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.bank.BankDO;
@ -45,7 +46,9 @@ public class UserBankServiceImpl implements UserBankService {
public Long createBank(UserBankSaveReqVO createReqVO) {
//校验银行卡号是否已存在
Long count = bankMapper.selectCount(BankDO::getBankNo, createReqVO.getBankNo());
Long count = bankMapper.selectCount(new LambdaQueryWrapperX<BankDO>()
.eq(BankDO::getBankNo, createReqVO.getBankNo())
.eq(BankDO::getNickname, createReqVO.getNickname()));
if (count > 0L) {
throw exception(BANK_EXISTS);
}

View File

@ -138,7 +138,7 @@ public interface DeptService {
*
* @return 部门信息列表
*/
List<DeptDO> getCompanyDept();
List<DeptDO> getCompanyDept(Integer method);
/**
* 获取所有工厂部门

View File

@ -330,14 +330,16 @@ public class DeptServiceImpl implements DeptService {
@Override
@DataPermission(enable = false)
public List<DeptDO> getCompanyDept() {
public List<DeptDO> getCompanyDept(Integer method) {
return deptMapper.selectList(new LambdaQueryWrapperX<DeptDO>()
.eq(method == 2, DeptDO::getVirtuallyStatus, 0)
.eq(method == 3, DeptDO::getVirtuallyStatus, 1)
.eq(DeptDO::getStatus, CommonStatusEnum.ENABLE.getStatus())
.eq(DeptDO::getType, DeptTypeEnum.COMPANY.getValue())
.or()
.eq(DeptDO::getType, DeptTypeEnum.HEAD_COMPANY.getValue())
.eq(DeptDO::getVirtuallyStatus, 0)
.eq(DeptDO::getStatus, CommonStatusEnum.ENABLE.getStatus()));
.eq(DeptDO::getType, DeptTypeEnum.HEAD_COMPANY.getValue()));
}
@Override

View File

@ -80,9 +80,9 @@ public class ProjectServiceImpl implements ProjectService {
@Override
public List<ProjectDO> getMyProject(Long userId) {
return projectMapper.selectList(new LambdaQueryWrapperX<ProjectDO>()
.eq(ProjectDO::getDirectorUserId, userId)
.or()
.like(ProjectDO::getStaff, userId)
// .eq(ProjectDO::getDirectorUserId, userId)
// .or()
// .like(ProjectDO::getStaff, userId)
.eq(ProjectDO::getStatus, 1));
}