feat(bpm): 添加我的出差申请列表功能
- 新增 getEvectionList 方法获取当前用户的出差申请列表 - 修改 selectEvectionList SQL 查询以排除已报销的出差申请 - 在前端添加我的出差申请列表接口和页面 -优化报销相关数据结构,增加业务表编号字段 - 修复流程实例创建时未配置岗位和部门的异常处理
This commit is contained in:
parent
4131f6100d
commit
4829400ae2
@ -8,9 +8,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDate;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
@ -34,8 +32,25 @@ public class BpmOAEvectionApiImpl implements BpmOAEvectionApi {
|
||||
List<BpmOAEvectionDO> evectionOff = evectionService.getEvectionListByEndTime(now.minusDays(1));
|
||||
|
||||
Map<String, List<Long>> result = new HashMap<>();
|
||||
result.put("on", evectionOn.stream().map(BpmOAEvectionDO::getUserId).distinct().collect(Collectors.toList()));
|
||||
result.put("off", evectionOff.stream().map(BpmOAEvectionDO::getUserId).distinct().collect(Collectors.toList()));
|
||||
result.put("on", evectionOn.stream().flatMap(item -> {
|
||||
Set<Long> togetherUserIds = item.getTogetherUserIds();
|
||||
List<Long> ids = new ArrayList<>();
|
||||
ids.add(item.getUserId());
|
||||
if (togetherUserIds != null) {
|
||||
ids.addAll(togetherUserIds); // 将 Set 转换为 List 并添加进去
|
||||
}
|
||||
return ids.stream();
|
||||
}).distinct().collect(Collectors.toList()));
|
||||
result.put("off", evectionOff.stream().flatMap(item -> {
|
||||
Set<Long> togetherUserIds = item.getTogetherUserIds();
|
||||
List<Long> ids = new ArrayList<>();
|
||||
ids.add(item.getUserId());
|
||||
if (togetherUserIds != null) {
|
||||
ids.addAll(togetherUserIds); // 将 Set 转换为 List 并添加进去
|
||||
}
|
||||
return ids.stream();
|
||||
}).distinct().collect(Collectors.toList()));
|
||||
|
||||
return success(result);
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.bpm.controller.admin.oa;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.evection.BpmOAEvectionCreateReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.evection.BpmOAEvectionRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.convert.oa.BpmOAEvectionConvert;
|
||||
@ -65,6 +66,15 @@ public class BpmOAEvectionController {
|
||||
return success(respVO);
|
||||
}
|
||||
|
||||
@GetMapping("/get-list")
|
||||
@Operation(summary = "获得我的出差申请")
|
||||
public CommonResult<List<BpmOAEvectionRespVO>> getEvectionList() {
|
||||
|
||||
List<BpmOAEvectionDO> evections = evectionService.getEvectionList();
|
||||
|
||||
return success(BeanUtils.toBean(evections, BpmOAEvectionRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/getByProcessInstanceId")
|
||||
@Operation(summary = "获得出差申请")
|
||||
@Parameter(name = "processInstanceId", description = "流程实例编号", required = true, example = "1024")
|
||||
|
@ -52,6 +52,9 @@ public class BpmOAReimbursementCreateReqVO {
|
||||
@Schema(description = "备用金差额", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private BigDecimal difference ;
|
||||
|
||||
@Schema(description = "业务表编号")
|
||||
private Long objectId;
|
||||
|
||||
@Schema(description = "报销发票总数", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "报销发票总数不能为空")
|
||||
private Integer totalQuantity ;
|
||||
|
@ -38,4 +38,7 @@ public class Reimbursement {
|
||||
|
||||
@Schema(description = "采购计划编号", example = "1")
|
||||
private Long procureId;
|
||||
|
||||
@Schema(description = "业务表编号")
|
||||
private Long objectId;
|
||||
}
|
||||
|
@ -36,4 +36,7 @@ public class ReimbursementDTO {
|
||||
|
||||
@Schema(description = "采购计划编号", example = "1")
|
||||
private Long procureId;
|
||||
|
||||
@Schema(description = "业务表编号")
|
||||
private Long objectId;
|
||||
}
|
||||
|
@ -68,4 +68,9 @@ public class BpmOAReimbursementItemDO extends BaseDO {
|
||||
* 采购申请编号
|
||||
*/
|
||||
private Long procureId;
|
||||
|
||||
/**
|
||||
* 业务表编号
|
||||
*/
|
||||
private Long objectId;
|
||||
}
|
||||
|
@ -6,8 +6,10 @@ import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.evection.BpmOAEvection
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAEvectionDO;
|
||||
import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 出差申请 Mapper
|
||||
@ -26,4 +28,6 @@ public interface BpmOAEvectionMapper extends BaseMapperX<BpmOAEvectionDO> {
|
||||
.geIfPresent(BpmOAEvectionDO::getEndTime, createReqVO.getStartTime())
|
||||
.in(BpmOAEvectionDO::getResult, Arrays.asList(BpmProcessInstanceResultEnum.PROCESS.getResult(), BpmProcessInstanceResultEnum.APPROVE.getResult())));
|
||||
}
|
||||
|
||||
List<BpmOAEvectionDO> selectEvectionList(@Param("userId") Long userId);
|
||||
}
|
||||
|
@ -54,4 +54,10 @@ public interface BpmOAEvectionService {
|
||||
* @return 出差申请列表
|
||||
*/
|
||||
List<BpmOAEvectionDO> getEvectionListByEndTime(LocalDate date);
|
||||
|
||||
/**
|
||||
* 获得我的出差申请列表
|
||||
* @return 出差申请列表
|
||||
*/
|
||||
List<BpmOAEvectionDO> getEvectionList();
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.OA_EVECTION_IS_EXISTS;
|
||||
import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.OA_EVECTION_NOT_EXISTS;
|
||||
|
||||
@ -150,4 +151,10 @@ public class BpmOAEvectionServiceImpl extends BpmOABaseService implements BpmOAE
|
||||
.eq(BpmOAEvectionDO::getResult, BpmProcessInstanceResultEnum.APPROVE.getResult())
|
||||
.likeIfPresent(BpmOAEvectionDO::getEndTime, date.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BpmOAEvectionDO> getEvectionList() {
|
||||
|
||||
return evectionMapper.selectEvectionList(getLoginUserId());
|
||||
}
|
||||
}
|
||||
|
@ -114,6 +114,7 @@ public class BpmOALoanServiceImpl extends BpmOABaseService implements BpmOALoanS
|
||||
processInstanceVariables.put("factoryType", factoryInfoDTO.getType());
|
||||
}
|
||||
|
||||
processInstanceVariables.put("loanType", loan.getLoanType());
|
||||
String processInstanceId = processInstanceService.createProcessInstance(userId,
|
||||
new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(PROCESS_KEY)
|
||||
.setVariables(processInstanceVariables).setBusinessKey(String.valueOf(loan.getId())));
|
||||
|
@ -276,9 +276,9 @@ public class BpmOAPaymentServiceImpl extends BpmOABaseService implements BpmOAPa
|
||||
// 获取银行卡信息
|
||||
BankRespDTO bankResp = bankApi.getBank(payment.getBankId()).getCheckedData();
|
||||
// 设置银行卡信息
|
||||
respVO.setBankName(bankResp.getBankName());
|
||||
respVO.setBankNo(bankResp.getBankNo());
|
||||
respVO.setNickname(bankResp.getNickname());
|
||||
respVO.setBankName(bankResp != null ? bankResp.getBankName() : null);
|
||||
respVO.setBankNo(bankResp != null ? bankResp.getBankNo() : null);
|
||||
respVO.setNickname(bankResp != null ? bankResp.getNickname() : null);
|
||||
}
|
||||
}
|
||||
return respVO;
|
||||
|
@ -25,7 +25,6 @@ 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.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.user.AdminUserApi;
|
||||
@ -101,6 +100,7 @@ public class BpmOAReimbursementServiceImpl extends BpmOABaseService implements B
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long createReimbursement(Long userId, BpmOAReimbursementCreateReqVO createReqVO) {
|
||||
BpmOAReimbursementDO reimbursement = BpmOAReimbursementConvert.INSTANCE.convert(createReqVO).setUserId(userId)
|
||||
.setResult(BpmProcessInstanceResultEnum.PROCESS.getResult());
|
||||
@ -120,6 +120,8 @@ public class BpmOAReimbursementServiceImpl extends BpmOABaseService implements B
|
||||
createDO.forEach(item -> item.setReimbursementId(reimbursement.getId()));
|
||||
reimbursementItemMapper.insertBatch(createDO);
|
||||
|
||||
// 同步更新
|
||||
|
||||
// 发起 BPM 流程
|
||||
Map<String, Object> processInstanceVariables = new HashMap<>();
|
||||
String processInstanceId = processInstanceApi.createProcessInstance(userId,
|
||||
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.bpm.dal.mysql.oa.BpmOAEvectionMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
<select id="selectEvectionList" resultType="cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAEvectionDO">
|
||||
SELECT
|
||||
a.*
|
||||
FROM
|
||||
bpm_oa_evection a
|
||||
WHERE
|
||||
a.id NOT IN (
|
||||
SELECT
|
||||
c.object_id
|
||||
FROM
|
||||
bpm_oa_reimbursement b,
|
||||
bpm_oa_reimbursement_item c
|
||||
WHERE
|
||||
b.user_id = #{userId}
|
||||
AND b.deleted = 0
|
||||
AND b.id = c.reimbursement_id
|
||||
AND b.result IN ( 1, 2 )
|
||||
AND c.type = 1
|
||||
AND c.object_id IS NOT NULL
|
||||
)
|
||||
AND a.user_id = #{userId}
|
||||
AND a.deleted = 0
|
||||
ORDER BY
|
||||
a.create_time DESC
|
||||
</select>
|
||||
</mapper>
|
@ -78,15 +78,23 @@
|
||||
<if test="pageReqVO.userId != null">
|
||||
AND a.user_id = #{pageReqVO.userId}
|
||||
</if>
|
||||
<if test="pageReqVO.factoryId != null">
|
||||
AND b.dept_id = #{pageReqVO.factoryId}
|
||||
</if>
|
||||
<if test="pageReqVO.type != null">
|
||||
AND b.type = #{pageReqVO.type}
|
||||
</if>
|
||||
<if test="pageReqVO.costSection != null">
|
||||
AND b.cost_section = #{pageReqVO.costSection}
|
||||
</if>
|
||||
AND EXISTS (
|
||||
SELECT
|
||||
1
|
||||
FROM
|
||||
bpm_oa_expenses_item b
|
||||
WHERE
|
||||
b.expenses_id = a.id
|
||||
<if test="pageReqVO.factoryId != null">
|
||||
AND b.dept_id = #{pageReqVO.factoryId}
|
||||
</if>
|
||||
<if test="pageReqVO.type != null">
|
||||
AND b.type = #{pageReqVO.type}
|
||||
</if>
|
||||
<if test="pageReqVO.costSection != null">
|
||||
AND b.cost_section = #{pageReqVO.costSection}
|
||||
</if>
|
||||
)
|
||||
<if test="pageReqVO.payeeName != null">
|
||||
AND ub.nickname LIKE CONCAT('%', #{pageReqVO.payeeName}, '%')
|
||||
</if>
|
||||
|
Loading…
Reference in New Issue
Block a user