修改 报销流程
追加收款人以及收款人账号字段 报销类别 变为字典值, 采购费时绑定采购计划 报销打印修改,追加抄送用户信息
This commit is contained in:
parent
7b9761de30
commit
108899cb52
@ -1,4 +1,5 @@
|
||||
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.reimbursement.BpmOAReimbursementRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.BpmTaskRespVO;
|
||||
@ -21,4 +22,22 @@ public class BpmOAReimbursementPrintDataRespVO extends BpmOABaseRespVO {
|
||||
@Schema(description = "流程审批节点信息【包含人员签名地址】", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
List<BpmTaskRespVO> processTasks ;
|
||||
|
||||
/**
|
||||
* 抄送用户信息
|
||||
*/
|
||||
private List<CCUser> ccUsers;
|
||||
|
||||
@Schema(description = "抄送用户信息")
|
||||
@Data
|
||||
public static class CCUser {
|
||||
|
||||
@Schema(description = "抄送用户编号", example = "146,128")
|
||||
private Long ccUserId;
|
||||
|
||||
@Schema(description = "抄送用户名称", example = "张三")
|
||||
private String ccUserName;
|
||||
|
||||
@Schema(description = "抄送用户部门名称", example = "研发部")
|
||||
private String ccDeptName;
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,15 @@ import java.util.List;
|
||||
@ToString(callSuper = true)
|
||||
public class BpmOAReimbursementCreateReqVO {
|
||||
|
||||
@Schema(description = "收款人名称")
|
||||
private String nickname;
|
||||
|
||||
@Schema(description = "收款人卡号")
|
||||
private String bankNo;
|
||||
|
||||
@Schema(description = "开户行信息")
|
||||
private String bankName;
|
||||
|
||||
@Schema(description = "报销项目明细", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "报销项目不能为空")
|
||||
private List<Reimbursement> reimbursements;
|
||||
@ -40,5 +49,4 @@ public class BpmOAReimbursementCreateReqVO {
|
||||
|
||||
@Schema(description = "上传文件", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private List<UploadUserFile> fileItems ;
|
||||
|
||||
}
|
||||
|
@ -18,10 +18,14 @@ public class BpmOAReimbursementRespVO extends BpmOABaseRespVO {
|
||||
/**
|
||||
* 收款人信息
|
||||
*/
|
||||
private PayeeUser payeeUser;
|
||||
@Schema(description = "收款人名称")
|
||||
private String nickname;
|
||||
|
||||
@Schema(description = "报销费用归属部门ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long belongDeptId ;
|
||||
@Schema(description = "开户行信息")
|
||||
private String bankName;
|
||||
|
||||
@Schema(description = "收款人卡号")
|
||||
private String bankNo;
|
||||
|
||||
@Schema(description = "报销项目明细", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "报销项目不能为空")
|
||||
@ -39,7 +43,10 @@ public class BpmOAReimbursementRespVO extends BpmOABaseRespVO {
|
||||
@NotNull(message = "报销类型不能为空")
|
||||
private BigDecimal reimbursementType ;
|
||||
|
||||
@Schema(description = "备用金差额", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@Schema(description = "备用金金额", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private BigDecimal amount ;
|
||||
|
||||
@Schema(description = "备用金差额 = 备用金额 - 报销总金额", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private BigDecimal difference ;
|
||||
|
||||
@Schema(description = "报销发票总数", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ -48,33 +55,4 @@ public class BpmOAReimbursementRespVO extends BpmOABaseRespVO {
|
||||
|
||||
@Schema(description = "上传文件", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private List<UploadUserFile> fileItems ;
|
||||
|
||||
@Schema(description = "收款人信息")
|
||||
@Data
|
||||
public static class PayeeUser {
|
||||
|
||||
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
|
||||
private String nickname;
|
||||
|
||||
@Schema(description = "部门编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Long deptId;
|
||||
|
||||
@Schema(description = "部门名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "研发部")
|
||||
private String deptName;
|
||||
|
||||
@Schema(description = "电子签名", requiredMode = Schema.RequiredMode.REQUIRED, example = "http://xxx.jpg")
|
||||
private String signURL;
|
||||
|
||||
@Schema(description = "用户银行卡业务表ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long bankId;
|
||||
|
||||
@Schema(description = "开户行信息", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String bankNName;
|
||||
|
||||
@Schema(description = "银行卡号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String bankNo;
|
||||
}
|
||||
}
|
||||
|
@ -15,11 +15,17 @@ import java.util.Date;
|
||||
@Data
|
||||
public class Reimbursement {
|
||||
|
||||
@Schema(description = "所属部门ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "128")
|
||||
private Long deptId;
|
||||
|
||||
@Schema(description = "所属部门名称", example = "研发部")
|
||||
private String deptName;
|
||||
|
||||
@Schema(description = "报销金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "23.45")
|
||||
private BigDecimal money;
|
||||
|
||||
@Schema(description = "报销类别", requiredMode = Schema.RequiredMode.REQUIRED, example = "如:住宿、火车票、宴请等")
|
||||
private String type;
|
||||
@Schema(description = "报销类别 字典值 参考 bpm_oa_reimbursement_type", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "发生时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "2024-02-09 12:31:12")
|
||||
private Date happenTime;
|
||||
@ -29,4 +35,7 @@ public class Reimbursement {
|
||||
|
||||
@Schema(description = "费用明细", requiredMode = Schema.RequiredMode.REQUIRED, example = "请吃饭")
|
||||
private String detail ;
|
||||
|
||||
@Schema(description = "采购计划编号", example = "1")
|
||||
private Long procureId;
|
||||
}
|
||||
|
@ -1,11 +1,17 @@
|
||||
package cn.iocoder.yudao.module.bpm.convert.oa;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.reimbursement.BpmOAReimbursementCreateReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.reimbursement.BpmOAReimbursementRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.reimbursement.Reimbursement;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAReimbursementDO;
|
||||
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 报销申请 Convert
|
||||
*
|
||||
@ -19,9 +25,19 @@ public interface BpmOAReimbursementConvert {
|
||||
BpmOAReimbursementDO convert(BpmOAReimbursementCreateReqVO bean);
|
||||
|
||||
BpmOAReimbursementRespVO convert(BpmOAReimbursementDO bean);
|
||||
//
|
||||
// List<BpmOALeaveRespVO> convertList(List<BpmOALeaveDO> list);
|
||||
//
|
||||
// PageResult<BpmOALeaveRespVO> convertPage(PageResult<BpmOALeaveDO> page);
|
||||
|
||||
default List<Reimbursement> convertList(List<Reimbursement> list, Map<Long, DeptRespDTO> deptMap) {
|
||||
|
||||
return CollectionUtils.convertList(list, reimbursement -> convert(reimbursement, deptMap.get(reimbursement.getDeptId())));
|
||||
}
|
||||
|
||||
default Reimbursement convert(Reimbursement reimbursement, DeptRespDTO dept) {
|
||||
|
||||
if (dept != null) {
|
||||
reimbursement.setDeptName(dept.getName());
|
||||
}
|
||||
|
||||
return reimbursement;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -49,6 +50,21 @@ public class BpmOAReimbursementDO extends BaseDO {
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 收款人名称
|
||||
*/
|
||||
private String nickname;
|
||||
|
||||
/**
|
||||
* 收款人卡号
|
||||
*/
|
||||
private String bankNo;
|
||||
|
||||
/**
|
||||
* 开户行信息
|
||||
*/
|
||||
private String bankName;
|
||||
|
||||
/**
|
||||
* 报销明细数据JSON
|
||||
*/
|
||||
|
@ -1,16 +1,22 @@
|
||||
package cn.iocoder.yudao.module.bpm.service.oa;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
|
||||
import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi;
|
||||
import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.procure.BpmOAProcureListEditReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.reimbursement.BpmOAReimbursementCreateReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.reimbursement.Reimbursement;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.upload.UploadUserFile;
|
||||
import cn.iocoder.yudao.module.bpm.convert.oa.BpmOAReimbursementConvert;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAImprestDO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAProcureDO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAReimbursementDO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.mysql.oa.BpmOAImprestMapper;
|
||||
import cn.iocoder.yudao.module.bpm.dal.mysql.oa.BpmOAReimbursementMapper;
|
||||
import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum;
|
||||
import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
|
||||
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
||||
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
||||
import org.flowable.engine.runtime.ProcessInstance;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -18,11 +24,13 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
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 static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
||||
import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.OA_REIMBURSEMENT_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
@ -57,6 +65,12 @@ public class BpmOAReimbursementServiceImpl extends BpmOABaseService implements B
|
||||
@Resource
|
||||
private BpmOAImprestMapper bpmOAImprestMapper;
|
||||
|
||||
@Resource
|
||||
private BpmOAProcureService bpmOAProcureService;
|
||||
|
||||
@Resource
|
||||
private DeptApi deptApi;
|
||||
|
||||
@Override
|
||||
public Long createReimbursement(Long userId, BpmOAReimbursementCreateReqVO createReqVO) {
|
||||
BpmOAReimbursementDO reimbursement = BpmOAReimbursementConvert.INSTANCE.convert(createReqVO).setUserId(userId)
|
||||
@ -78,6 +92,31 @@ public class BpmOAReimbursementServiceImpl extends BpmOABaseService implements B
|
||||
bpmOAImprestMapper.updateById(new BpmOAImprestDO().setId(bpmOAImprestDO.getId()).setReimbursementId(reimbursement.getId()).setStatus(BpmOAImprestDO.IN_PROGRESS));
|
||||
}
|
||||
|
||||
//判断是否有 采购报销
|
||||
List<Long> procureIds = new ArrayList<>();
|
||||
for (Reimbursement data : reimbursement.getReimbursements()) {
|
||||
|
||||
//报销类别为 采购费时
|
||||
if (data.getType() == 4) {
|
||||
|
||||
BpmOAProcureDO procureDO = bpmOAProcureService.getOaProcure(data.getProcureId());
|
||||
if (procureDO != null) {
|
||||
|
||||
procureIds.add(procureDO.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!procureIds.isEmpty()) {
|
||||
|
||||
//所有关联的采购申请改为 进行中状态
|
||||
bpmOAProcureService.updatePayFlagByIds(
|
||||
new BpmOAProcureListEditReqVO()
|
||||
.setPayFlag(BpmOAProcureDO.IN_PROGRESS)
|
||||
.setProcureIds(procureIds)
|
||||
);
|
||||
}
|
||||
|
||||
List<UploadUserFile> fileItems = createReqVO.getFileItems() ;
|
||||
//这里的逻辑,如果fileItems不为空,且有数据,那么说明是上传了附件的,则需要更工作流文件表对应的实例Id
|
||||
if (fileItems != null && !fileItems.isEmpty()) {
|
||||
@ -95,12 +134,49 @@ public class BpmOAReimbursementServiceImpl extends BpmOABaseService implements B
|
||||
if (BpmProcessInstanceResultEnum.APPROVE.getResult().equals(result)) {
|
||||
|
||||
ProcessInstance instance = bpmProcessInstanceService.getProcessInstance(processInstanceId);
|
||||
BpmOAImprestDO bpmOAImprestDO = bpmOAImprestMapper.selectOne(BpmOAImprestDO::getReimbursementId, id);
|
||||
|
||||
if (instance.isEnded() && bpmOAImprestDO != null) {
|
||||
if (instance.isEnded()) {
|
||||
|
||||
//将相应备用金申请状态改为 已报销
|
||||
bpmOAImprestMapper.updateById(new BpmOAImprestDO().setId(bpmOAImprestDO.getId()).setStatus(BpmOAImprestDO.FLAG_TRUE));
|
||||
//获得备用金信息
|
||||
BpmOAImprestDO bpmOAImprestDO = bpmOAImprestMapper.selectOne(BpmOAImprestDO::getReimbursementId, id);
|
||||
if (bpmOAImprestDO != null) {
|
||||
|
||||
//将相应备用金申请状态改为 已报销
|
||||
bpmOAImprestMapper.updateById(new BpmOAImprestDO().setId(bpmOAImprestDO.getId()).setStatus(BpmOAImprestDO.FLAG_TRUE));
|
||||
}
|
||||
|
||||
//判断是否有采购报销
|
||||
List<Long> procureIds = new ArrayList<>();
|
||||
BpmOAReimbursementDO bpmOAReimbursementDO = getReimbursement(id);
|
||||
List<Reimbursement> reimbursements = bpmOAReimbursementDO.getReimbursements();
|
||||
|
||||
//直接从数据库取出来的List<Reimbursement> 实际上是List<LinkedHashMap>类型 所以不能直接遍历
|
||||
//将list再次转为json串,然后由json串再转为list
|
||||
String json = JsonUtils.toJsonString(reimbursements);
|
||||
reimbursements = JsonUtils.parseArray(json, Reimbursement.class);
|
||||
|
||||
for (Reimbursement reimbursement : reimbursements) {
|
||||
|
||||
//报销类别为 采购费时
|
||||
if (reimbursement.getType() == 4) {
|
||||
|
||||
BpmOAProcureDO procureDO = bpmOAProcureService.getOaProcure(reimbursement.getProcureId());
|
||||
if (procureDO != null) {
|
||||
|
||||
procureIds.add(procureDO.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!procureIds.isEmpty()) {
|
||||
|
||||
//所有关联的采购申请改为 已支付状态
|
||||
bpmOAProcureService.updatePayFlagByIds(
|
||||
new BpmOAProcureListEditReqVO()
|
||||
.setPayFlag(BpmOAProcureDO.FLAG_TRUE)
|
||||
.setProcureIds(procureIds)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -118,6 +194,39 @@ public class BpmOAReimbursementServiceImpl extends BpmOABaseService implements B
|
||||
//将相应备用金申请状态改为 未报销
|
||||
bpmOAImprestMapper.updateById(new BpmOAImprestDO().setId(bpmOAImprestDO.getId()).setStatus(BpmOAImprestDO.FLAG_FALSE));
|
||||
}
|
||||
|
||||
//判断是否有采购报销
|
||||
List<Long> procureIds = new ArrayList<>();
|
||||
BpmOAReimbursementDO bpmOAReimbursementDO = getReimbursement(id);
|
||||
List<Reimbursement> reimbursements = bpmOAReimbursementDO.getReimbursements();
|
||||
|
||||
//直接从数据库取出来的List<Reimbursement> 实际上是List<LinkedHashMap>类型 所以不能直接遍历
|
||||
//将list再次转为json串,然后由json串再转为list
|
||||
String json = JsonUtils.toJsonString(reimbursements);
|
||||
reimbursements = JsonUtils.parseArray(json, Reimbursement.class);
|
||||
|
||||
for (Reimbursement reimbursement : reimbursements) {
|
||||
|
||||
//报销类别为 采购费时
|
||||
if (reimbursement.getType() == 4) {
|
||||
|
||||
BpmOAProcureDO procureDO = bpmOAProcureService.getOaProcure(reimbursement.getProcureId());
|
||||
if (procureDO != null) {
|
||||
|
||||
procureIds.add(procureDO.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!procureIds.isEmpty()) {
|
||||
|
||||
//所有关联的采购申请改为 未支付状态
|
||||
bpmOAProcureService.updatePayFlagByIds(
|
||||
new BpmOAProcureListEditReqVO()
|
||||
.setPayFlag(BpmOAProcureDO.FLAG_FALSE)
|
||||
.setProcureIds(procureIds)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
reimbursementMapper.updateById(new BpmOAReimbursementDO().setId(id).setResult(result));
|
||||
@ -131,6 +240,20 @@ public class BpmOAReimbursementServiceImpl extends BpmOABaseService implements B
|
||||
|
||||
@Override
|
||||
public BpmOAReimbursementDO getReimbursement(Long id) {
|
||||
return reimbursementMapper.selectById(id);
|
||||
|
||||
BpmOAReimbursementDO reimbursementDO = reimbursementMapper.selectById(id);
|
||||
List<Reimbursement> reimbursement = reimbursementDO.getReimbursements();
|
||||
|
||||
//直接从数据库取出来的List<Reimbursement> 实际上是List<LinkedHashMap>类型 所以不能直接遍历
|
||||
//将list再次转为json串,然后由json串再转为list
|
||||
String json = JsonUtils.toJsonString(reimbursement);
|
||||
reimbursement = JsonUtils.parseArray(json, Reimbursement.class);
|
||||
|
||||
Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(convertSet(reimbursement, Reimbursement::getDeptId));
|
||||
|
||||
//插入部门名称
|
||||
reimbursementDO.setReimbursements(BpmOAReimbursementConvert.INSTANCE.convertList(reimbursement, deptMap));
|
||||
|
||||
return reimbursementDO;
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
@ -418,6 +418,7 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
||||
paramMap.put("post_id", postId.toString());
|
||||
paramMap.put("user_id", userId.toString());
|
||||
paramMap.put("dept_id", startUser.getDeptId().toString()); //配置发起人部门id
|
||||
paramMap.put("dept_flag", startDeptInfo.getFlag()); //配置发起人部门flag
|
||||
|
||||
paramMap.put("approve_reason", reqVO.getReason()); //通过原因---因为Task任务的通过,是通过监听事件处理的,reason数据无法传递给监听函数。所以通过此中方法传递
|
||||
taskService.complete(task.getId(), paramMap);
|
||||
@ -718,6 +719,7 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateTaskExtAssign(Task task) {
|
||||
// BpmTaskExtDO taskExtDO =
|
||||
// new BpmTaskExtDO().setAssigneeUserId(NumberUtils.parseLong(task.getAssignee())).setTaskId(task.getId());
|
||||
|
Loading…
Reference in New Issue
Block a user