feat:钱包冻结流程
This commit is contained in:
1 parent
93add403c7
commit
d4e424e39d
23 files changed
+305
-102
No files matched your search
@@ -46,7 +46,7 @@ CREATE TABLE wallet_manage
|
||||
total_expense int DEFAULT 0 NOT NULL COMMENT '累计支出,单位分',
|
||||
total_recharge int DEFAULT 0 NOT NULL COMMENT '累计充值,单位分',
|
||||
freeze_price int DEFAULT 0 NOT NULL COMMENT '冻结金额,单位分',
|
||||
is_freeze tinyint DEFAULT '0' NOT NULL COMMENT '是否冻结饭卡',
|
||||
is_freeze char(1) DEFAULT '0' NOT NULL COMMENT '是否冻结饭卡',
|
||||
active_bind_time timestamp COMMENT '绑定饭卡时间',
|
||||
active_bind_status char(10) COMMENT '饭卡绑定状态',
|
||||
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
|
||||
|
||||
+1
-1
@@ -40,5 +40,5 @@ public class QRCodeExtraDto {
|
||||
/**
|
||||
* 是否冻结饭卡
|
||||
*/
|
||||
private Boolean isFreeze = false;
|
||||
private String isFreeze = "1";
|
||||
}
|
||||
+1
-1
@@ -43,5 +43,5 @@ public class HardAdUserVo {
|
||||
/**
|
||||
* 是否冻结饭卡
|
||||
*/
|
||||
private Boolean walletIsFreeze;
|
||||
private String walletIsFreeze;
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
+1
-1
@@ -31,7 +31,7 @@ public class WalletRechargeExcelDto {
|
||||
private Long lineNum;
|
||||
|
||||
@ColumnWidth(100)
|
||||
@ExcelProperty("用户名")
|
||||
@ExcelProperty("用户姓名")
|
||||
private String username;
|
||||
|
||||
@ColumnWidth(100)
|
||||
|
||||
+65
-64
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import com.bsd.pjcloud.common.core.util.TenantTable;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
@@ -24,94 +25,94 @@ import java.time.LocalDateTime;
|
||||
public class WalletFreezeEntity extends Model<WalletFreezeEntity> {
|
||||
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description="编号")
|
||||
@Schema(description = "编号")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 流程id
|
||||
*/
|
||||
@Schema(description = "流程id")
|
||||
private String processId;
|
||||
/**
|
||||
* 流程id
|
||||
*/
|
||||
@Schema(description = "流程id")
|
||||
private String processId;
|
||||
|
||||
/**
|
||||
* 流程状态
|
||||
*/
|
||||
@Schema(description = "流程状态")
|
||||
private String processStatus;
|
||||
/**
|
||||
* 流程状态
|
||||
*/
|
||||
@Schema(description = "流程状态")
|
||||
private String processStatus;
|
||||
|
||||
/**
|
||||
* 钱包id
|
||||
*/
|
||||
@Schema(description="钱包id")
|
||||
/**
|
||||
* 钱包id
|
||||
*/
|
||||
@Schema(description = "钱包id")
|
||||
private Long walletId;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@Schema(description="用户id")
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@Schema(description = "用户id")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 部门id
|
||||
*/
|
||||
@Schema(description="部门id")
|
||||
private Long deptId;
|
||||
/**
|
||||
* 部门id
|
||||
*/
|
||||
@Schema(description = "部门id")
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 冻结状态
|
||||
*/
|
||||
@Schema(description="冻结状态")
|
||||
/**
|
||||
* 冻结状态
|
||||
*/
|
||||
@Schema(description = "冻结状态")
|
||||
private String freeStatus;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Schema(description="备注")
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description="创建人")
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "创建人")
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description="创建时间")
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description="修改人")
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description = "修改人")
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description="修改时间")
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description = "修改时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 删除标记
|
||||
*/
|
||||
/**
|
||||
* 删除标记
|
||||
*/
|
||||
@TableLogic
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description="删除标记")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "删除标记")
|
||||
private String delFlag;
|
||||
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
@Schema(description="租户ID")
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
@Schema(description = "租户ID")
|
||||
private Long tenantId;
|
||||
}
|
||||
+6
-4
@@ -3,8 +3,7 @@ package com.bsd.pjcloud.wallet.api.entity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.*;
|
||||
import com.bsd.pjcloud.common.core.util.TenantTable;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
@@ -15,6 +14,9 @@ import java.time.LocalDateTime;
|
||||
* @author dzc
|
||||
* @date 2024-12-30 09:06:35
|
||||
*/
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@TenantTable
|
||||
@TableName("wallet_manage")
|
||||
@@ -82,7 +84,7 @@ public class WalletManageEntity extends Model<WalletManageEntity> {
|
||||
* 是否冻结饭卡
|
||||
*/
|
||||
@Schema(description = "是否冻结饭卡")
|
||||
private Boolean isFreeze;
|
||||
private String isFreeze;
|
||||
|
||||
/**
|
||||
* 绑定饭卡时间
|
||||
@@ -91,7 +93,7 @@ public class WalletManageEntity extends Model<WalletManageEntity> {
|
||||
private LocalDateTime activeBindTime;
|
||||
|
||||
/**
|
||||
* 饭卡绑定状态
|
||||
* 饭卡绑定状态 1已经绑定 0未绑定
|
||||
*/
|
||||
@Schema(description = "饭卡绑定状态")
|
||||
private String activeBindStatus;
|
||||
|
||||
+2
-2
@@ -32,9 +32,9 @@ public interface BaseWalletInterface {
|
||||
|
||||
void setWalletFreezePrice(Integer walletFreezePrice);
|
||||
|
||||
Boolean getWalletIsFreeze();
|
||||
String getWalletIsFreeze();
|
||||
|
||||
void setWalletIsFreeze(Boolean walletIsFreeze);
|
||||
void setWalletIsFreeze(String walletIsFreeze);
|
||||
|
||||
LocalDateTime getWalletActiveBindTime();
|
||||
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ public class WalletTransactionVo extends WalletTransactionEntity implements Base
|
||||
|
||||
private Integer walletFreezePrice;
|
||||
|
||||
private Boolean walletIsFreeze;
|
||||
private String walletIsFreeze;
|
||||
|
||||
private LocalDateTime walletActiveBindTime;
|
||||
|
||||
|
||||
+13
@@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.idempotent.annotation.Idempotent;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
import com.bsd.pjcloud.common.security.util.SecurityUtils;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletActiveDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletActiveEntity;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletActiveVo;
|
||||
@@ -65,6 +67,17 @@ public class WalletActiveController {
|
||||
}
|
||||
/* ************************************* end android end ************************************* */
|
||||
|
||||
|
||||
/* ************************************* start android start ************************************* */
|
||||
@PostMapping("/app/bind-card")
|
||||
@SysLog("app绑定饭卡")
|
||||
@Operation(summary = "app绑定饭卡")
|
||||
public R<Boolean> appBindCard(@RequestBody WalletActiveDto dto) {
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
return R.ok(walletActiveService.appBindCard(dto, user));
|
||||
}
|
||||
/* ************************************* end android end ************************************* */
|
||||
|
||||
@GetMapping("/refresh-avatar")
|
||||
@Operation(summary = "重新激活")
|
||||
@SysLog("重新激活")
|
||||
|
||||
+17
@@ -13,6 +13,7 @@ import com.bsd.pjcloud.common.security.annotation.Inner;
|
||||
import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
import com.bsd.pjcloud.common.security.util.SecurityUtils;
|
||||
import com.bsd.pjcloud.flow.task.dto.ProcessNodeRecordAssignUserParamDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletActiveDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletFreezeDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.MchManageEntity;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletFreezeEntity;
|
||||
@@ -53,6 +54,22 @@ public class WalletFreezeController {
|
||||
}
|
||||
/* ************************************* start flow callback start ************************************* */
|
||||
|
||||
/* ************************************* start app start ************************************* */
|
||||
@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.getRemark())) {
|
||||
throw new RuntimeException("备注不能为空");
|
||||
}
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
walletFreezeService.applyFreeze(dto, user);
|
||||
return R.ok(true);
|
||||
}
|
||||
/* ************************************* start end start ************************************* */
|
||||
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletFreeze_view')")
|
||||
|
||||
-1
@@ -111,7 +111,6 @@ public class WalletManageController {
|
||||
public R<String> getQrCode(@RequestParam Long walletId) {
|
||||
return R.ok(walletManageService.getQrCode(walletId));
|
||||
}
|
||||
|
||||
/* ************************************* end app end ************************************* */
|
||||
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
|
||||
+1
-1
@@ -67,7 +67,7 @@ public class WalletTransactionController {
|
||||
public R appGetAll(@ParameterObject Page page, @ParameterObject WalletTransactionDto dto) {
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
dto.setUserId(user.getId());
|
||||
return R.ok(walletTransactionService.scopePageList(page, dto));
|
||||
return R.ok(walletTransactionService.pageJoin(page, dto));
|
||||
}
|
||||
/* ************************************* end app end ************************************* */
|
||||
|
||||
|
||||
+24
@@ -2,9 +2,11 @@ package com.bsd.pjcloud.wallet.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletActiveDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletActiveEntity;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletActiveVo;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
|
||||
public interface WalletActiveService extends IService<WalletActiveEntity> {
|
||||
/**
|
||||
@@ -23,10 +25,32 @@ public interface WalletActiveService extends IService<WalletActiveEntity> {
|
||||
|
||||
/**
|
||||
* 重新激活
|
||||
*
|
||||
* @param id 开卡id
|
||||
*/
|
||||
Boolean refreshAvatar(Long id);
|
||||
|
||||
/**
|
||||
* 绑定饭卡
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
Boolean appBindCard(WalletActiveDto dto, PjcloudUser user);
|
||||
|
||||
/**
|
||||
* 卡号是否存在
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Boolean exitCardNumber(Long id, String CardNumber);
|
||||
|
||||
/**
|
||||
* 更具卡号查询开卡信息
|
||||
* @return
|
||||
*/
|
||||
WalletActiveEntity getByCardNumber(@NotEmpty String cardNumber);
|
||||
|
||||
Page<WalletActiveVo> pageJoin(Page page, WalletActiveDto dto);
|
||||
|
||||
Page<WalletActiveVo> scopePageList(Page page, WalletActiveDto dto);
|
||||
|
||||
+3
@@ -2,6 +2,7 @@ package com.bsd.pjcloud.wallet.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
import com.bsd.pjcloud.flow.task.dto.ProcessNodeRecordAssignUserParamDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletFreezeDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletFreezeEntity;
|
||||
@@ -16,4 +17,6 @@ public interface WalletFreezeService extends IService<WalletFreezeEntity> {
|
||||
Long create(WalletFreezeDto dto);
|
||||
|
||||
void applyCallback(ProcessNodeRecordAssignUserParamDto dto);
|
||||
|
||||
void applyFreeze(WalletFreezeDto dto, PjcloudUser user);
|
||||
}
|
||||
+8
@@ -45,6 +45,14 @@ public interface WalletManageService extends IService<WalletManageEntity> {
|
||||
WalletManageEntity getWallet(@NotNull Long userId, @NotNull WalletTypeEnum walletTypeCode);
|
||||
|
||||
|
||||
/**
|
||||
* 获取钱包(没有缓存)
|
||||
* @param cardNumber
|
||||
* @return
|
||||
*/
|
||||
WalletManageEntity getWallet(@NotNull String cardNumber);
|
||||
|
||||
|
||||
/**
|
||||
* 获取钱包(没有缓存)
|
||||
*
|
||||
|
||||
+4
-8
@@ -9,6 +9,10 @@ import com.bsd.pjcloud.wallet.api.vo.transaction.WalletTransactionVo;
|
||||
|
||||
public interface WalletTransactionService extends IService<WalletTransactionEntity> {
|
||||
|
||||
Page<WalletTransactionVo> scopePageList(Page page, WalletTransactionDto dto);
|
||||
|
||||
Page<WalletTransactionVo> pageJoin(Page page, WalletTransactionDto dto);
|
||||
|
||||
/**
|
||||
* 扣减钱包余额
|
||||
*
|
||||
@@ -38,12 +42,4 @@ public interface WalletTransactionService extends IService<WalletTransactionEnti
|
||||
* @return
|
||||
*/
|
||||
Boolean updateWalletBalance(WalletTransactionDto dto);
|
||||
|
||||
/**
|
||||
* 分页查询复杂查询
|
||||
* @param page
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
Page<WalletTransactionVo> scopePageList(Page page, WalletTransactionDto dto);
|
||||
}
|
||||
+49
-3
@@ -2,6 +2,7 @@ package com.bsd.pjcloud.wallet.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.admin.api.entity.SysDept;
|
||||
@@ -13,12 +14,14 @@ import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum;
|
||||
import com.bsd.pjcloud.common.core.exception.CheckedException;
|
||||
import com.bsd.pjcloud.common.core.util.CollectionUtils;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
import com.bsd.pjcloud.wallet.api.constant.WalletTypeEnum;
|
||||
import com.bsd.pjcloud.wallet.api.dto.MchManageDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletActiveDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletTypeDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.MchManageEntity;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletActiveEntity;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletManageEntity;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletTypeEntity;
|
||||
import com.bsd.pjcloud.wallet.api.utils.WalletDataUtil;
|
||||
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
|
||||
@@ -27,6 +30,7 @@ import com.bsd.pjcloud.wallet.mapper.WalletActiveMapper;
|
||||
import com.bsd.pjcloud.wallet.mapper.WalletTypeMapper;
|
||||
import com.bsd.pjcloud.wallet.service.MchManageService;
|
||||
import com.bsd.pjcloud.wallet.service.WalletActiveService;
|
||||
import com.bsd.pjcloud.wallet.service.WalletManageService;
|
||||
import com.bsd.pjcloud.wallet.service.WalletTypeService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -34,6 +38,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -50,6 +55,7 @@ import java.util.Map;
|
||||
@Service
|
||||
public class WalletActiveServiceImpl extends ServiceImpl<WalletActiveMapper, WalletActiveEntity> implements WalletActiveService {
|
||||
|
||||
private final WalletManageService walletManageService;
|
||||
private final WalletTypeService walletTypeService;
|
||||
private final MchManageService mchManageService;
|
||||
|
||||
@@ -111,6 +117,46 @@ public class WalletActiveServiceImpl extends ServiceImpl<WalletActiveMapper, Wal
|
||||
return baseMapper.updateById(updateObj) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean appBindCard(WalletActiveDto dto, PjcloudUser user) {
|
||||
WalletActiveEntity walletActive = getByCardNumber(dto.getCardNumber());
|
||||
if (ObjectUtil.isEmpty(walletActive)) {
|
||||
throw new RuntimeException("卡号不存在");
|
||||
}
|
||||
WalletManageEntity wallet = walletManageService.getWallet(dto.getCardNumber());
|
||||
if (ObjectUtil.isNotEmpty(wallet)) {
|
||||
throw new RuntimeException("该卡号已经绑定用户");
|
||||
}
|
||||
WalletManageEntity selfWallet = walletManageService.getWallet(dto.getWalletId());
|
||||
if (ObjectUtil.isNotEmpty(selfWallet) && ObjectUtil.isNotEmpty(selfWallet.getCardNumber())) {
|
||||
throw new RuntimeException("用户已绑定饭卡");
|
||||
}
|
||||
// 更新开卡记录
|
||||
WalletActiveEntity walletActiveObj = WalletActiveEntity.builder().id(walletActive.getId()).userId(user.getId()).walletId(selfWallet.getId()).walletTypeId(selfWallet.getWalletTypeId()).build();
|
||||
baseMapper.updateById(walletActiveObj);
|
||||
// 更新用户钱包
|
||||
WalletManageEntity walletObj = WalletManageEntity.builder().id(selfWallet.getId()).cardNumber(walletActive.getCardNumber()).activeBindStatus(YesNoEnum.YES.getCode()).activeBindTime(LocalDateTime.now()).build();
|
||||
walletManageService.updateById(walletObj);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean exitCardNumber(Long id, String CardNumber) {
|
||||
Long count = baseMapper.selectCount(new LambdaQueryWrapper<WalletActiveEntity>()
|
||||
.eq(ObjectUtil.isNotEmpty(id), WalletActiveEntity::getId, id)
|
||||
.eq(ObjectUtil.isNotEmpty(CardNumber), WalletActiveEntity::getCardNumber, CardNumber)
|
||||
);
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WalletActiveEntity getByCardNumber(String cardNumber) {
|
||||
return baseMapper.selectOne(new LambdaQueryWrapper<WalletActiveEntity>()
|
||||
.eq(WalletActiveEntity::getCardNumber, cardNumber)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<WalletActiveVo> pageJoin(Page page, WalletActiveDto dto) {
|
||||
Page<WalletActiveVo> list = baseMapper.pageJoin(page, dto);
|
||||
@@ -156,7 +202,7 @@ public class WalletActiveServiceImpl extends ServiceImpl<WalletActiveMapper, Wal
|
||||
if (ObjectUtil.isNotEmpty(userIds)) {
|
||||
R<List<SysUser>> userList = userService.getUserById(new ArrayList<>(userIds));
|
||||
if (ObjectUtil.isNotEmpty(userList.getData())) {
|
||||
DataUtil.convertUserList(page.getRecords(), CollectionUtils.convertMap(userList.getData(), SysUser::getUserId));
|
||||
DataUtil.convertUserList(list.getRecords(), CollectionUtils.convertMap(userList.getData(), SysUser::getUserId));
|
||||
}
|
||||
}
|
||||
// 部门
|
||||
@@ -164,7 +210,7 @@ public class WalletActiveServiceImpl extends ServiceImpl<WalletActiveMapper, Wal
|
||||
if (ObjectUtil.isNotEmpty(deptIds)) {
|
||||
R<Map<Long, SysDept>> deptList = deptService.getDeptByDeptIds(deptIds);
|
||||
if (ObjectUtil.isNotEmpty(deptList.getData())) {
|
||||
DataUtil.convertDeptList(page.getRecords(), deptList.getData());
|
||||
DataUtil.convertDeptList(list.getRecords(), deptList.getData());
|
||||
}
|
||||
}
|
||||
// 商户
|
||||
@@ -172,7 +218,7 @@ public class WalletActiveServiceImpl extends ServiceImpl<WalletActiveMapper, Wal
|
||||
if (ObjectUtil.isNotEmpty(mchIds)) {
|
||||
List<MchManageVo> mchList = mchManageService.list(MchManageDto.builder().ids(mchIds).build());
|
||||
if (ObjectUtil.isNotEmpty(mchList)) {
|
||||
WalletDataUtil.convertMchList(page.getRecords(), CollectionUtils.convertMap(mchList, MchManageVo::getId));
|
||||
WalletDataUtil.convertMchList(list.getRecords(), CollectionUtils.convertMap(mchList, MchManageVo::getId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+46
-10
@@ -3,6 +3,7 @@ package com.bsd.pjcloud.wallet.service.impl;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -17,6 +18,7 @@ import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum;
|
||||
import com.bsd.pjcloud.common.core.util.CollectionUtils;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
import com.bsd.pjcloud.flow.task.constant.NodeStatusEnum;
|
||||
import com.bsd.pjcloud.flow.task.constant.TaskCheckStatusEnum;
|
||||
import com.bsd.pjcloud.flow.task.dto.ProcessNodeRecordAssignUserParamDto;
|
||||
@@ -132,16 +134,7 @@ public class WalletFreezeServiceImpl extends ServiceImpl<WalletFreezeMapper, Wal
|
||||
if (ObjectUtil.isEmpty(dept)) throw new RuntimeException("发起人部门不存在");
|
||||
baseMapper.insert(dto);
|
||||
// 发起审批
|
||||
WalletFreezeApplyFlowDto flowDto = new WalletFreezeApplyFlowDto();
|
||||
flowDto.setApplyUsername(userData.getSysUser().getUsername());
|
||||
flowDto.setApplyUserId(userData.getSysUser().getUserId());
|
||||
flowDto.setApplyDeptName(dept.getName());
|
||||
flowDto.setApplyDeptId(dept.getDeptId());
|
||||
flowDto.setApplyCreateTime(LocalDateTimeUtil.format(LocalDateTime.now(), DatePattern.NORM_DATETIME_PATTERN));
|
||||
flowDto.setCardNumber(wallet.getCardNumber());
|
||||
flowDto.setRemark(dto.getRemark());
|
||||
String processId = flowUtil.startFlow("TASK_FREEZE_FLOW", userData.getSysUser(), dto.getId(), flowDto);
|
||||
baseMapper.updateById(WalletFreezeEntity.builder().id(dto.getId()).processId(processId).build());
|
||||
getSelf().applyFlow(userData, dept, wallet, dto);
|
||||
return dto.getId();
|
||||
}
|
||||
|
||||
@@ -162,12 +155,51 @@ public class WalletFreezeServiceImpl extends ServiceImpl<WalletFreezeMapper, Wal
|
||||
Boolean isConsent = flowUtil.isConsent(dto);
|
||||
String processStatus = isConsent ? TaskCheckStatusEnum.RESULT.getCode() : TaskCheckStatusEnum.REJECT.getCode();
|
||||
baseMapper.updateById(WalletFreezeEntity.builder().id(detail.getId()).freeStatus(YesNoEnum.YES.getCode()).processStatus(processStatus).build());
|
||||
if (isConsent) {
|
||||
// 更改钱包状态
|
||||
WalletManageEntity walletUpdateObj = WalletManageEntity.builder().id(detail.getWalletId()).isFreeze(YesNoEnum.YES.getCode()).build();
|
||||
walletManageService.updateById(walletUpdateObj);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("|{}|审批回调意外的错误,dto:|{}|error:|{}|", TAG, JSON.toJSONString(dto), e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void applyFreeze(WalletFreezeDto dto, PjcloudUser user) {
|
||||
WalletManageEntity wallet = walletManageService.getWallet(dto.getWalletId());
|
||||
if (ObjectUtil.isEmpty(wallet)) throw new RuntimeException("钱包不存在");
|
||||
// 判断之前有没有在审核的
|
||||
if (isCheckData(dto.getUserId())) throw new RuntimeException("已提交申请,请勿重复提交");
|
||||
// 查询发起人
|
||||
UserInfo userData = userService.getByUserId(user.getId()).getData();
|
||||
// 查询部门
|
||||
SysDept dept = deptService.getDeptByDeptId(user.getDeptId()).getData();
|
||||
if (ObjectUtil.isEmpty(dept)) throw new RuntimeException("用户部门不存在");
|
||||
// 添加钱包冻结记录
|
||||
WalletFreezeEntity saveObj = WalletFreezeEntity.builder().walletId(wallet.getId()).userId(user.getId()).deptId(user.getDeptId()).processStatus(TaskCheckStatusEnum.PADDING.getCode()).freeStatus(YesNoEnum.YES.getCode()).remark(dto.getRemark()).build();
|
||||
baseMapper.insert(saveObj);
|
||||
// 发起审批
|
||||
getSelf().applyFlow(userData, dept, wallet, saveObj);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void applyFlow(UserInfo userInfo, SysDept dept, WalletManageEntity wallet, WalletFreezeEntity obj) {
|
||||
// 发起审批
|
||||
WalletFreezeApplyFlowDto flowDto = new WalletFreezeApplyFlowDto();
|
||||
flowDto.setApplyUsername(userInfo.getSysUser().getUsername());
|
||||
flowDto.setApplyUserId(userInfo.getSysUser().getUserId());
|
||||
flowDto.setApplyDeptName(dept.getName());
|
||||
flowDto.setApplyDeptId(dept.getDeptId());
|
||||
flowDto.setApplyCreateTime(LocalDateTimeUtil.format(LocalDateTime.now(), DatePattern.NORM_DATETIME_PATTERN));
|
||||
flowDto.setCardNumber(wallet.getCardNumber());
|
||||
flowDto.setRemark(obj.getRemark());
|
||||
String processId = flowUtil.startFlow("TASK_FREEZE_FLOW", userInfo.getSysUser(), obj.getId(), flowDto);
|
||||
baseMapper.updateById(WalletFreezeEntity.builder().id(obj.getId()).processId(processId).build());
|
||||
}
|
||||
|
||||
private boolean isCheckData(Long walletId) {
|
||||
Long count = baseMapper.selectCount(new LambdaQueryWrapper<WalletFreezeEntity>()
|
||||
.eq(WalletFreezeEntity::getUserId, walletId)
|
||||
@@ -176,4 +208,8 @@ public class WalletFreezeServiceImpl extends ServiceImpl<WalletFreezeMapper, Wal
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
private WalletFreezeServiceImpl getSelf() {
|
||||
return SpringUtil.getBean(getClass());
|
||||
}
|
||||
|
||||
}
|
||||
+7
-1
@@ -137,6 +137,12 @@ public class WalletManageServiceImpl extends ServiceImpl<WalletManageMapper, Wal
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WalletManageEntity getWallet(String cardNumber) {
|
||||
return baseMapper.selectOne(new LambdaQueryWrapper<WalletManageEntity>()
|
||||
.eq(WalletManageEntity::getCardNumber, cardNumber));
|
||||
}
|
||||
|
||||
@Override
|
||||
public WalletManageEntity getWallet(Long userId, Long walletTypeId) {
|
||||
WalletTypeEntity walletType = walletTypeService.getById(walletTypeId);
|
||||
@@ -148,7 +154,7 @@ public class WalletManageServiceImpl extends ServiceImpl<WalletManageMapper, Wal
|
||||
}
|
||||
|
||||
@Override
|
||||
@Cacheable(value = CacheConstants.WALLET_DETAIL, key = "#walletId", condition = "#walletId != null", unless = "#result == null")
|
||||
// @Cacheable(value = CacheConstants.WALLET_DETAIL, key = "#walletId", condition = "#walletId != null", unless = "#result == null")
|
||||
public WalletManageEntity getWallet(Long walletId) {
|
||||
return baseMapper.selectById(walletId);
|
||||
}
|
||||
|
||||
+48
@@ -199,4 +199,52 @@ public class WalletTransactionServiceImpl extends ServiceImpl<WalletTransactionM
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<WalletTransactionVo> pageJoin(Page page, WalletTransactionDto dto) {
|
||||
Page<WalletTransactionVo> list = baseMapper.pageJoin(page, dto);
|
||||
if (ObjectUtil.isNotEmpty(list.getRecords())) {
|
||||
// 用户
|
||||
List<Long> userIds = list.getRecords().stream().map(WalletTransactionVo::getUserId).distinct().toList();
|
||||
R<List<SysUser>> userList = userService.getUserById(new ArrayList<>(userIds));
|
||||
if (ObjectUtil.isNotEmpty(userList.getData())) {
|
||||
DataUtil.convertUserList(list.getRecords(), CollectionUtils.convertMap(userList.getData(), SysUser::getUserId));
|
||||
}
|
||||
// 部门
|
||||
List<Long> deptIds = list.getRecords().stream().map(WalletTransactionVo::getDeptId).distinct().toList();
|
||||
R<Map<Long, SysDept>> deptList = deptService.getDeptByDeptIds(deptIds);
|
||||
if (ObjectUtil.isNotEmpty(deptList.getData())) {
|
||||
DataUtil.convertDeptList(list.getRecords(), deptList.getData());
|
||||
}
|
||||
// 饭卡
|
||||
List<Long> walletIds = list.getRecords().stream().map(WalletTransactionVo::getWalletId).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(walletIds)) {
|
||||
WalletManageDto walletManageDto = new WalletManageDto();
|
||||
walletManageDto.setWalletIds(walletIds);
|
||||
List<WalletManageEntity> walletList = walletManageMapper.list(walletManageDto);
|
||||
if (ObjectUtil.isNotEmpty(walletList)) {
|
||||
WalletDataUtil.convertWalletList(list.getRecords(), CollectionUtils.convertMap(walletList, WalletManageEntity::getId));
|
||||
}
|
||||
}
|
||||
// 饭卡类型
|
||||
List<Long> walletTypeIds = list.getRecords().stream().map(WalletTransactionVo::getWalletTypeId).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(walletTypeIds)) {
|
||||
WalletTypeDto walletTypeDto = new WalletTypeDto();
|
||||
walletTypeDto.setWalletTypeIds(walletTypeIds);
|
||||
List<WalletTypeEntity> walletTypeList = walletTypeMapper.list(walletTypeDto);
|
||||
if (ObjectUtil.isNotEmpty(walletTypeList)) {
|
||||
WalletDataUtil.convertWalletTypeList(list.getRecords(), CollectionUtils.convertMap(walletTypeList, WalletTypeEntity::getId));
|
||||
}
|
||||
}
|
||||
// 订单
|
||||
if (dto.getIsFindOrder()) {
|
||||
list.getRecords().forEach(v -> {
|
||||
if (ObjectUtil.isNotEmpty(v.getBizId())) {
|
||||
v.setOrderId(Long.valueOf(v.getBizId()));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
+7
-3
@@ -238,11 +238,15 @@ public class WalletRechargeApplyServiceImpl extends ServiceImpl<WalletRechargeAp
|
||||
errors.add("用户手机号格式不正确");
|
||||
} else {
|
||||
R<UserInfo> user = userService.getUserByNameAndMobile(v.getUsername(), v.getUserMobile());
|
||||
Optional<Long> userId = Optional.of(user).map(R::getData).map(UserInfo::getSysUser).map(SysUser::getUserId);
|
||||
if (userId.isEmpty()) {
|
||||
Optional<SysUser> sysUser = Optional.of(user).map(R::getData).map(UserInfo::getSysUser);
|
||||
if (sysUser.isEmpty()) {
|
||||
errors.add("用户不存在");
|
||||
} else {
|
||||
v.setUserId(userId.get());
|
||||
if (!ObjectUtil.equals(sysUser.get().getName(), v.getUsername())) {
|
||||
errors.add("用户不存在");
|
||||
} else {
|
||||
v.setUserId(sysUser.get().getUserId());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(errors)) {
|
||||
|
||||
Reference in new issue
Block a user