refactor(bpm): 重构资产申领流程并更新实体类- 申领流程更新:从BpmOAAssetClaimCreateReqVO中移除businessType、num和util字段,新增receive字段以支持申领明细。
- 实体类更新:在BpmOAAssetClaimDO中移除assetsTypeId、businessType、num和util字段,新增receive字段。 - 响应VO变更:在BpmOAAssetClaimRespVO中移除assetsTypeId、assetsTypeName、businessType、num和util字段,新增receive字段。 - 服务层调整:更新BpmOAAssetClaimServiceImpl中的createAssetClaim方法以适配receive字段。 - 新增详情类:创建Receive和ReceiveRespVO类来管理资产申领明细。 - 远程服务配置:在RpcConfiguration中注册新使用的AssetReceiveApi。 BREAKING CHANGE: 此调整对资产申领的业务逻辑进行了重大重构,可能影响依赖于原字段结构的上下游系统。
This commit is contained in:
parent
5ffffb58a5
commit
c2457e08c5
@ -24,14 +24,8 @@ public class BpmOAAssetClaimCreateReqVO {
|
||||
@NotNull(message = "资产类型不能为空")
|
||||
private Long assetsTypeId;
|
||||
|
||||
@Schema(description = "业务类型")
|
||||
private Integer businessType;
|
||||
|
||||
@Schema(description = "数量")
|
||||
private Integer num;
|
||||
|
||||
@Schema(description = "单位")
|
||||
private String util;
|
||||
@Schema(description = "申领明细")
|
||||
private List<Receive> receive;
|
||||
|
||||
@Schema(description = "申请原因")
|
||||
private String reason;
|
||||
|
@ -18,20 +18,8 @@ import java.util.List;
|
||||
@ToString(callSuper = true)
|
||||
public class BpmOAAssetClaimRespVO extends BpmOABaseRespVO {
|
||||
|
||||
@Schema(description = "资产类型编号")
|
||||
private Long assetsTypeId;
|
||||
|
||||
@Schema(description = "资产类型名称")
|
||||
private String assetsTypeName;
|
||||
|
||||
@Schema(description = "业务类型")
|
||||
private Integer businessType;
|
||||
|
||||
@Schema(description = "数量")
|
||||
private Integer num;
|
||||
|
||||
@Schema(description = "单位")
|
||||
private String util;
|
||||
@Schema(description = "申领明细")
|
||||
private List<ReceiveRespVO> receive;
|
||||
|
||||
@Schema(description = "申请原因")
|
||||
private String reason;
|
||||
|
@ -0,0 +1,22 @@
|
||||
package cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.assetClaim;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 资产申领明细VO")
|
||||
@Data
|
||||
public class Receive {
|
||||
|
||||
@Schema(description = "资产类型编号")
|
||||
private Long assetsTypeId;
|
||||
|
||||
@Schema(description = "业务类型")
|
||||
private Integer businessType;
|
||||
|
||||
@Schema(description = "数量")
|
||||
private Integer num;
|
||||
|
||||
@Schema(description = "使用单位")
|
||||
private String util;
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.assetClaim;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 资产申领明细VO")
|
||||
@Data
|
||||
public class ReceiveRespVO {
|
||||
|
||||
@Schema(description = "资产类型编号")
|
||||
private Long assetsTypeId;
|
||||
|
||||
@Schema(description = "资产类型名称")
|
||||
private String assetsTypeName;
|
||||
|
||||
@Schema(description = "业务类型")
|
||||
private Integer businessType;
|
||||
|
||||
@Schema(description = "数量")
|
||||
private Integer num;
|
||||
|
||||
@Schema(description = "使用单位")
|
||||
private String util;
|
||||
}
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.bpm.dal.dataobject.oa;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.UploadUserFile;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.assetClaim.Receive;
|
||||
import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
@ -38,24 +39,10 @@ public class BpmOAAssetClaimDO extends BaseDO {
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 资产类型编号
|
||||
* 申领明细
|
||||
*/
|
||||
private Long assetsTypeId;
|
||||
|
||||
/**
|
||||
* 业务类型
|
||||
*/
|
||||
private Integer businessType;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private Integer num;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
private String util;
|
||||
@TableField(typeHandler = JacksonTypeHandler.class)
|
||||
private List<Receive> receive;
|
||||
|
||||
/**
|
||||
* 申请事由
|
||||
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.bpm.framework.rpc.config;
|
||||
|
||||
import cn.iocoder.yudao.module.infra.api.config.ConfigApi;
|
||||
import cn.iocoder.yudao.module.infra.api.file.FileApi;
|
||||
import cn.iocoder.yudao.module.system.api.assetreceive.AssetReceiveApi;
|
||||
import cn.iocoder.yudao.module.system.api.assets.AssetsApi;
|
||||
import cn.iocoder.yudao.module.system.api.assets.AssetsTypeApi;
|
||||
import cn.iocoder.yudao.module.system.api.attendance.AttendanceApi;
|
||||
@ -24,7 +25,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableFeignClients(clients = {FileApi.class, RoleApi.class, DeptApi.class, PostApi.class, AdminUserApi.class, SmsSendApi.class, DictDataApi.class, NotifyMessageSendApi.class,
|
||||
SubscribeMessageSendApi.class, SocialClientApi.class, UsersExtApi.class, AttendanceApi.class, BankApi.class, ConfigApi.class, PositionApi.class, SupplierApi.class, AssetsApi.class,
|
||||
AssetsTypeApi.class
|
||||
AssetsTypeApi.class, AssetReceiveApi.class
|
||||
})
|
||||
public class RpcConfiguration {
|
||||
}
|
||||
|
@ -4,15 +4,25 @@ 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.assetClaim.BpmOAAssetClaimCreateReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.assetClaim.Receive;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAAssetClaimDO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.mysql.oa.BpmOAAssetClaimMapper;
|
||||
import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum;
|
||||
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.assetreceive.AssetReceiveApi;
|
||||
import cn.iocoder.yudao.module.system.api.assetreceive.dto.AssetReceiveSaveDTO;
|
||||
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;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import org.flowable.engine.runtime.ProcessInstance;
|
||||
import org.springframework.stereotype.Service;
|
||||
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;
|
||||
@ -43,6 +53,12 @@ public class BpmOAAssetClaimServiceImpl extends BpmOABaseService implements BpmO
|
||||
@Resource
|
||||
private BpmHistoryProcessInstanceService historyProcessInstanceService;
|
||||
|
||||
@Resource
|
||||
private AssetReceiveApi receiveApi;
|
||||
|
||||
@Resource
|
||||
private AdminUserApi userApi;
|
||||
|
||||
@Override
|
||||
public Long createAssetClaim(Long userId, BpmOAAssetClaimCreateReqVO createReqVO) {
|
||||
|
||||
@ -87,15 +103,45 @@ public class BpmOAAssetClaimServiceImpl extends BpmOABaseService implements BpmO
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateAssetClaimResult(String processInstanceId, Long id, Integer result) {
|
||||
|
||||
validateLeaveExists(id);
|
||||
BpmOAAssetClaimDO assetClaim = validateLeaveExists(id);
|
||||
|
||||
// 获取用户信息
|
||||
AdminUserRespDTO userRespDTO = userApi.getUser(assetClaim.getUserId()).getCheckedData();
|
||||
|
||||
//审核通过 (最后节点)
|
||||
if (BpmProcessInstanceResultEnum.APPROVE.getResult().equals(result)) {
|
||||
|
||||
ProcessInstance instance = processInstanceService.getProcessInstance(processInstanceId);
|
||||
|
||||
if (instance.isEnded()) {
|
||||
|
||||
List<AssetReceiveSaveDTO> receiveDTOs = new ArrayList<>();
|
||||
for (Receive receive : assetClaim.getReceive()) {
|
||||
|
||||
receiveDTOs.add(new AssetReceiveSaveDTO()
|
||||
.setUserId(assetClaim.getUserId())
|
||||
.setDeptId(userRespDTO.getDeptId())
|
||||
.setAssetsTypeId(receive.getAssetsTypeId())
|
||||
.setNum(receive.getNum())
|
||||
.setApplyDate(assetClaim.getCreateTime().toLocalDate())
|
||||
.setStatus(0));
|
||||
}
|
||||
|
||||
// 批量插入资产领用信息
|
||||
receiveApi.createReceive(receiveDTOs);
|
||||
}
|
||||
}
|
||||
assetClaimMapper.updateById(new BpmOAAssetClaimDO().setId(id).setResult(result));
|
||||
}
|
||||
|
||||
private void validateLeaveExists(Long id) {
|
||||
if (assetClaimMapper.selectById(id) == null) {
|
||||
private BpmOAAssetClaimDO validateLeaveExists(Long id) {
|
||||
BpmOAAssetClaimDO assetClaim = assetClaimMapper.selectById(id);
|
||||
if (assetClaim == null) {
|
||||
throw exception(OA_ASSET_NOT_EXISTS);
|
||||
}
|
||||
return assetClaim;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user