feat:删除解冻

This commit is contained in:
dzc committed 2025-05-29 11:15:38 +08:00
1 parent 8358512b7b
commit 905d0c7548
5 files changed
+24 -32

No files matched your search

+1
View File
@@ -69,6 +69,7 @@ CREATE TABLE `third_pay_log`
`biz_type` varchar(32) NOT NULL COMMENT '支付类型',
`biz_id` varchar(2048) DEFAULT NULL COMMENT '支付类型id',
`api_url` text DEFAULT NULL COMMENT 'api-url',
`header` text DEFAULT NULL COMMENT 'header',
`res` text DEFAULT NULL COMMENT 'res',
`req` text DEFAULT NULL COMMENT 'req',
`error` text DEFAULT NULL COMMENT '调用错误',
@@ -82,7 +82,6 @@ public class WalletManageEntity extends Model<WalletManageEntity> {
private Integer freezePrice;
/**
* @deprecated 已废弃
* 是否冻结饭卡
*/
@Schema(description = "是否冻结饭卡")
@@ -54,13 +54,14 @@ public class WalletFreezeController {
@PostMapping("/app/apply-freeze")
@Operation(summary = "申请冻结")
public R<Object> appApplyFreeze(@RequestBody WalletFreezeDto dto) {
if (ObjectUtil.isEmpty(dto.getWalletId())) {
throw new RuntimeException("钱包id不能为空");
if (ObjectUtil.isEmpty(dto.getWalletTypeId())) {
throw new RuntimeException("钱包类型id不能为空");
}
if (ObjectUtil.isEmpty(dto.getRemark())) {
throw new RuntimeException("备注不能为空");
}
PjcloudUser user = SecurityUtils.getUser();
dto.setUserId(user.getId());
walletFreezeService.applyFreeze(dto, user);
return R.ok(true);
}
@@ -94,7 +95,9 @@ public class WalletFreezeController {
@PostMapping
@PreAuthorize("@pms.hasPermission('wallet_walletFreeze_add')")
public R save(@RequestBody WalletFreezeDto dto) {
return R.ok(walletFreezeService.create(dto));
PjcloudUser user = SecurityUtils.getUser();
walletFreezeService.applyFreeze(dto, user);
return R.ok();
}
@Operation(summary = "新增饭卡冻结记录表", description = "新增饭卡冻结记录表")
@@ -104,7 +107,8 @@ public class WalletFreezeController {
public R appSave(@RequestBody WalletFreezeDto dto) {
PjcloudUser loginUser = SecurityUtils.getUser();
dto.setUserId(loginUser.getId());
return R.ok(walletFreezeService.create(dto));
walletFreezeService.applyFreeze(dto, loginUser);
return R.ok();
}
@Operation(summary = "修改饭卡冻结记录表", description = "修改饭卡冻结记录表")
@@ -16,8 +16,6 @@ public interface WalletFreezeService extends IService<WalletFreezeEntity> {
Page<WalletFreezeVo> scopePageList(Page page, WalletFreezeDto dto);
Long create(WalletFreezeDto dto);
void applyCallback(ProcessNodeRecordAssignUserParamDto dto);
void applyFreeze(WalletFreezeDto dto, PjcloudUser user);
@@ -85,30 +85,6 @@ public class WalletFreezeServiceImpl extends ServiceImpl<WalletFreezeMapper, Wal
return list;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Long create(WalletFreezeDto dto) {
// 查询发起人
UserInfo userData = userService.getInnerByUserId(dto.getUserId()).getData();
if (ObjectUtil.isEmpty(userData)) throw new RuntimeException("发起人不存在");
// 判断之前有没有在审核的
if (isCheckData(dto.getUserId())) throw new RuntimeException("已提交申请,请勿重复提交");
// 查询钱包
WalletManageEntity wallet = walletManageService.getWallet(dto.getUserId(), dto.getWalletTypeId());
if (ObjectUtil.isEmpty(wallet)) throw new RuntimeException("用户钱包不存在");
dto.setDeptId(userData.getSysUser().getDeptId());
dto.setFreeStatus(YesNoEnum.NO.getCode());
dto.setWalletId(wallet.getId());
dto.setProcessStatus(TaskCheckStatusEnum.PADDING.getCode());
// 查询部门
SysDept dept = deptService.getDeptByDeptId(dto.getDeptId()).getData();
if (ObjectUtil.isEmpty(dept)) throw new RuntimeException("发起人部门不存在");
baseMapper.insert(dto);
// 发起审批
getSelf().applyFlow(userData, dept, wallet, dto);
return dto.getId();
}
@Override
@Transactional(rollbackFor = Exception.class)
public void applyCallback(ProcessNodeRecordAssignUserParamDto dto) {
@@ -140,7 +116,7 @@ public class WalletFreezeServiceImpl extends ServiceImpl<WalletFreezeMapper, Wal
@Override
@Transactional(rollbackFor = Exception.class)
public void applyFreeze(WalletFreezeDto dto, PjcloudUser user) {
WalletManageEntity wallet = walletManageService.getWallet(dto.getWalletId());
WalletManageEntity wallet = walletManageService.getWallet(dto.getUserId(), dto.getWalletTypeId());
if (ObjectUtil.isEmpty(wallet)) throw new RuntimeException("钱包不存在");
// 判断之前有没有在审核的
if (isCheckData(dto.getUserId())) throw new RuntimeException("已提交申请,请勿重复提交");
@@ -167,6 +143,20 @@ public class WalletFreezeServiceImpl extends ServiceImpl<WalletFreezeMapper, Wal
dto.setProcessInstanceIdList(walletFreezeList.stream().map(WalletFreezeEntity::getProcessId).toList());
remoteFlowEngineService.stopProcessInstance(dto).getData();
}
for (Long v : list) {
WalletFreezeEntity walletFreeze = baseMapper.selectById(v);
if (ObjectUtil.isEmpty(walletFreeze)) {
continue;
}
if (ObjectUtil.notEqual(walletFreeze.getProcessStatus(), TaskCheckStatusEnum.RESULT.getCode())) {
continue;
}
// 取消冻结
if (ObjectUtil.equals(walletFreeze.getFreeStatus(), YesNoEnum.YES.getCode())) {
WalletManageEntity walletUpdateObj = WalletManageEntity.builder().id(walletFreeze.getWalletId()).isFreeze(YesNoEnum.NO.getCode()).build();
walletManageService.updateById(walletUpdateObj);
}
}
this.removeByIds(list);
}