feat:冻结、开卡代码生成

This commit is contained in:
dzc committed 2024-12-31 19:05:37 +08:00
1 parent c60c07dc82
commit e4e05b53da
17 files changed
+601 -12

No files matched your search

+9 -12
View File
@@ -9,7 +9,7 @@ CREATE TABLE wallet_manage
id bigint NOT NULL COMMENT '主键',
user_id bigint NOT NULL COMMENT '饭卡绑定的用户id',
wallet_type_id bigint NOT NULL COMMENT '饭卡类型id',
dept_id BIGINT NOT NULL COMMENT '部门id',
dept_id bigint NOT NULL COMMENT '部门id',
card_number varchar(64) COMMENT '饭卡卡号',
balance int DEFAULT 0 NOT NULL COMMENT '余额,单位分',
total_expense int DEFAULT 0 NOT NULL COMMENT '累计支出,单位分',
@@ -61,10 +61,10 @@ CREATE TABLE wallet_active
user_id bigint NOT NULL COMMENT '用户id',
wallet_id bigint NOT NULL COMMENT '钱包id',
wallet_type_id bigint NOT NULL COMMENT '饭卡类型id',
dept_id BIGINT NOT NULL COMMENT '部门id',
merchant_id BIGINT NOT NULL COMMENT '商户id',
dept_id bigint NOT NULL COMMENT '部门id',
merchant_id bigint NOT NULL COMMENT '商户id',
card_number varchar(128) NOT NULL COMMENT '用户卡号',
is_active_hardware BIT DEFAULT 0 COMMENT '饭卡是否在硬件上激活',
is_active_hardware char(1) DEFAULT '0' COMMENT '饭卡是否在硬件上激活',
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
create_time datetime DEFAULT NULL COMMENT '创建时间',
update_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
@@ -75,8 +75,7 @@ CREATE TABLE wallet_active
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 COMMENT ='钱包开卡';
CREATE INDEX idx_dept_id ON wallet_active (user_id);
CREATE INDEX idx_dept_id ON wallet_active (wallet_id);
CREATE INDEX idx_dept_id ON wallet_active (wallet_type_id);
CREATE INDEX idx_dept_id ON wallet_active (dept_id);
-- ----------------------------
-- Table structure for wallet_freeze
@@ -84,10 +83,10 @@ CREATE INDEX idx_dept_id ON wallet_active (wallet_type_id);
DROP TABLE IF EXISTS wallet_freeze;
CREATE TABLE wallet_freeze
(
id bigint NOT NULL COMMENT '编号',
wallet_id bigint NOT NULL COMMENT '钱包id',
user_id bigint NOT NULL COMMENT '用户id',
free_status TINYINT NOT NULL COMMENT '冻结状态',
id bigint NOT NULL COMMENT '编号',
wallet_id bigint NOT NULL COMMENT '钱包id',
user_id bigint NOT NULL COMMENT '用户id',
free_status tinytext NOT NULL COMMENT '冻结状态',
remark varchar(1024) COMMENT '备注',
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
create_time datetime DEFAULT NULL COMMENT '创建时间',
@@ -98,8 +97,6 @@ CREATE TABLE wallet_freeze
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 COMMENT ='饭卡冻结记录表';
CREATE INDEX idx_dept_id ON wallet_freeze (wallet_id);
CREATE INDEX idx_dept_id ON wallet_freeze (user_id);
-- ----------------------------
-- Table structure for wallet_transaction
@@ -0,0 +1,8 @@
package com.bsd.pjcloud.wallet.api.dto;
import com.bsd.pjcloud.wallet.api.entity.WalletActiveEntity;
import lombok.Data;
@Data
public class WalletActiveDto extends WalletActiveEntity {
}
@@ -0,0 +1,8 @@
package com.bsd.pjcloud.wallet.api.dto;
import com.bsd.pjcloud.wallet.api.entity.WalletFreezeEntity;
import lombok.Data;
@Data
public class WalletFreezeEntityDto extends WalletFreezeEntity {
}
@@ -0,0 +1,115 @@
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 com.bsd.pjcloud.common.core.util.TenantTable;
import java.time.LocalDateTime;
/**
* 钱包开卡
*
* @author dzc
* @date 2024-12-31 18:53:31
*/
@Data
@TenantTable
@TableName("wallet_active")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "钱包开卡")
public class WalletActiveEntity extends Model<WalletActiveEntity> {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description="主键")
private Long id;
/**
* 用户id
*/
@Schema(description="用户id")
private Long userId;
/**
* 钱包id
*/
@Schema(description="钱包id")
private Long walletId;
/**
* 饭卡类型id
*/
@Schema(description="饭卡类型id")
private Long walletTypeId;
/**
* 部门id
*/
@Schema(description="部门id")
private Long deptId;
/**
* 商户id
*/
@Schema(description="商户id")
private Long merchantId;
/**
* 用户卡号
*/
@Schema(description="用户卡号")
private String cardNumber;
/**
* 饭卡是否在硬件上激活
*/
@Schema(description="饭卡是否在硬件上激活")
private String isActiveHardware;
/**
* 创建人
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description="创建人")
private String createBy;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description="创建时间")
private LocalDateTime createTime;
/**
* 修改人
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description="修改人")
private String updateBy;
/**
* 修改时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description="修改时间")
private LocalDateTime updateTime;
/**
* 删除标记
*/
@TableLogic
@TableField(fill = FieldFill.INSERT)
@Schema(description="删除标记")
private String delFlag;
/**
* 租户ID
*/
@Schema(description="租户ID")
private Long tenantId;
}
@@ -0,0 +1,97 @@
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 com.bsd.pjcloud.common.core.util.TenantTable;
import java.time.LocalDateTime;
/**
* 饭卡冻结记录表
*
* @author dzc
* @date 2024-12-31 18:54:43
*/
@Data
@TenantTable
@TableName("wallet_freeze")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "饭卡冻结记录表")
public class WalletFreezeEntity extends Model<WalletFreezeEntity> {
/**
* 编号
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description="编号")
private Long id;
/**
* 钱包id
*/
@Schema(description="钱包id")
private Long walletId;
/**
* 用户id
*/
@Schema(description="用户id")
private Long userId;
/**
* 冻结状态
*/
@Schema(description="冻结状态")
private String freeStatus;
/**
* 备注
*/
@Schema(description="备注")
private String remark;
/**
* 创建人
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description="创建人")
private String createBy;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description="创建时间")
private LocalDateTime createTime;
/**
* 修改人
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description="修改人")
private String updateBy;
/**
* 修改时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description="修改时间")
private LocalDateTime updateTime;
/**
* 删除标记
*/
@TableLogic
@TableField(fill = FieldFill.INSERT)
@Schema(description="删除标记")
private String delFlag;
/**
* 租户ID
*/
@Schema(description="租户ID")
private Long tenantId;
}
@@ -0,0 +1,8 @@
package com.bsd.pjcloud.wallet.api.vo;
import com.bsd.pjcloud.wallet.api.entity.WalletActiveEntity;
import lombok.Data;
@Data
public class WalletActiveVo extends WalletActiveEntity {
}
@@ -0,0 +1,8 @@
package com.bsd.pjcloud.wallet.api.vo;
import com.bsd.pjcloud.wallet.api.entity.WalletFreezeEntity;
import lombok.Data;
@Data
public class WalletFreezeVo extends WalletFreezeEntity {
}
@@ -0,0 +1,119 @@
package com.bsd.pjcloud.wallet.controller;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.log.annotation.SysLog;
import com.bsd.pjcloud.wallet.api.entity.WalletActiveEntity;
import com.bsd.pjcloud.wallet.service.WalletActiveService;
import org.springframework.security.access.prepost.PreAuthorize;
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.http.HttpHeaders;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Objects;
/**
* 钱包开卡
*
* @author dzc
* @date 2024-12-31 18:53:31
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/walletActive" )
@Tag(description = "walletActive" , name = "钱包开卡管理" )
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class WalletActiveController {
private final WalletActiveService walletActiveService;
/**
* 分页查询
* @param page 分页对象
* @param walletActive 钱包开卡
* @return
*/
@Operation(summary = "分页查询" , description = "分页查询" )
@GetMapping("/page" )
@PreAuthorize("@pms.hasPermission('wallet_walletActive_view')" )
public R getWalletActivePage(@ParameterObject Page page, @ParameterObject WalletActiveEntity walletActive) {
LambdaQueryWrapper<WalletActiveEntity> wrapper = Wrappers.lambdaQuery();
return R.ok(walletActiveService.page(page, wrapper));
}
/**
* 通过id查询钱包开卡
* @param id id
* @return R
*/
@Operation(summary = "通过id查询" , description = "通过id查询" )
@GetMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('wallet_walletActive_view')" )
public R getById(@PathVariable("id" ) Long id) {
return R.ok(walletActiveService.getById(id));
}
/**
* 新增钱包开卡
* @param walletActive 钱包开卡
* @return R
*/
@Operation(summary = "新增钱包开卡" , description = "新增钱包开卡" )
@SysLog("新增钱包开卡" )
@PostMapping
@PreAuthorize("@pms.hasPermission('wallet_walletActive_add')" )
public R save(@RequestBody WalletActiveEntity walletActive) {
return R.ok(walletActiveService.save(walletActive));
}
/**
* 修改钱包开卡
* @param walletActive 钱包开卡
* @return R
*/
@Operation(summary = "修改钱包开卡" , description = "修改钱包开卡" )
@SysLog("修改钱包开卡" )
@PutMapping
@PreAuthorize("@pms.hasPermission('wallet_walletActive_edit')" )
public R updateById(@RequestBody WalletActiveEntity walletActive) {
return R.ok(walletActiveService.updateById(walletActive));
}
/**
* 通过id删除钱包开卡
* @param ids id列表
* @return R
*/
@Operation(summary = "通过id删除钱包开卡" , description = "通过id删除钱包开卡" )
@SysLog("通过id删除钱包开卡" )
@DeleteMapping
@PreAuthorize("@pms.hasPermission('wallet_walletActive_del')" )
public R removeById(@RequestBody Long[] ids) {
return R.ok(walletActiveService.removeBatchByIds(CollUtil.toList(ids)));
}
/**
* 导出excel 表格
* @param walletActive 查询条件
* @param ids 导出指定ID
* @return excel 文件流
*/
@ResponseExcel
@GetMapping("/export")
@PreAuthorize("@pms.hasPermission('wallet_walletActive_export')" )
public List<WalletActiveEntity> export(WalletActiveEntity walletActive,Long[] ids) {
return walletActiveService.list(Wrappers.lambdaQuery(walletActive).in(ArrayUtil.isNotEmpty(ids), WalletActiveEntity::getId, ids));
}
}
@@ -0,0 +1,118 @@
package com.bsd.pjcloud.wallet.controller;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.log.annotation.SysLog;
import com.bsd.pjcloud.wallet.api.entity.WalletFreezeEntity;
import com.bsd.pjcloud.wallet.service.WalletFreezeService;
import org.springframework.security.access.prepost.PreAuthorize;
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.http.HttpHeaders;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 饭卡冻结记录表
*
* @author dzc
* @date 2024-12-31 18:54:43
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/walletFreeze" )
@Tag(description = "walletFreeze" , name = "饭卡冻结记录表管理" )
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class WalletFreezeController {
private final WalletFreezeService walletFreezeService;
/**
* 分页查询
* @param page 分页对象
* @param walletFreeze 饭卡冻结记录表
* @return
*/
@Operation(summary = "分页查询" , description = "分页查询" )
@GetMapping("/page" )
@PreAuthorize("@pms.hasPermission('wallet_walletFreeze_view')" )
public R getWalletFreezePage(@ParameterObject Page page, @ParameterObject WalletFreezeEntity walletFreeze) {
LambdaQueryWrapper<WalletFreezeEntity> wrapper = Wrappers.lambdaQuery();
return R.ok(walletFreezeService.page(page, wrapper));
}
/**
* 通过id查询饭卡冻结记录表
* @param id id
* @return R
*/
@Operation(summary = "通过id查询" , description = "通过id查询" )
@GetMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('wallet_walletFreeze_view')" )
public R getById(@PathVariable("id" ) Long id) {
return R.ok(walletFreezeService.getById(id));
}
/**
* 新增饭卡冻结记录表
* @param walletFreeze 饭卡冻结记录表
* @return R
*/
@Operation(summary = "新增饭卡冻结记录表" , description = "新增饭卡冻结记录表" )
@SysLog("新增饭卡冻结记录表" )
@PostMapping
@PreAuthorize("@pms.hasPermission('wallet_walletFreeze_add')" )
public R save(@RequestBody WalletFreezeEntity walletFreeze) {
return R.ok(walletFreezeService.save(walletFreeze));
}
/**
* 修改饭卡冻结记录表
* @param walletFreeze 饭卡冻结记录表
* @return R
*/
@Operation(summary = "修改饭卡冻结记录表" , description = "修改饭卡冻结记录表" )
@SysLog("修改饭卡冻结记录表" )
@PutMapping
@PreAuthorize("@pms.hasPermission('wallet_walletFreeze_edit')" )
public R updateById(@RequestBody WalletFreezeEntity walletFreeze) {
return R.ok(walletFreezeService.updateById(walletFreeze));
}
/**
* 通过id删除饭卡冻结记录表
* @param ids id列表
* @return R
*/
@Operation(summary = "通过id删除饭卡冻结记录表" , description = "通过id删除饭卡冻结记录表" )
@SysLog("通过id删除饭卡冻结记录表" )
@DeleteMapping
@PreAuthorize("@pms.hasPermission('wallet_walletFreeze_del')" )
public R removeById(@RequestBody Long[] ids) {
return R.ok(walletFreezeService.removeBatchByIds(CollUtil.toList(ids)));
}
/**
* 导出excel 表格
* @param walletFreeze 查询条件
* @param ids 导出指定ID
* @return excel 文件流
*/
@ResponseExcel
@GetMapping("/export")
@PreAuthorize("@pms.hasPermission('wallet_walletFreeze_export')" )
public List<WalletFreezeEntity> export(WalletFreezeEntity walletFreeze,Long[] ids) {
return walletFreezeService.list(Wrappers.lambdaQuery(walletFreeze).in(ArrayUtil.isNotEmpty(ids), WalletFreezeEntity::getId, ids));
}
}
@@ -0,0 +1,11 @@
package com.bsd.pjcloud.wallet.mapper;
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
import com.bsd.pjcloud.wallet.api.entity.WalletActiveEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface WalletActiveMapper extends PjcloudBaseMapper<WalletActiveEntity> {
}
@@ -0,0 +1,11 @@
package com.bsd.pjcloud.wallet.mapper;
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
import com.bsd.pjcloud.wallet.api.entity.WalletFreezeEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface WalletFreezeMapper extends PjcloudBaseMapper<WalletFreezeEntity> {
}
@@ -0,0 +1,8 @@
package com.bsd.pjcloud.wallet.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.bsd.pjcloud.wallet.api.entity.WalletActiveEntity;
public interface WalletActiveService extends IService<WalletActiveEntity> {
}
@@ -0,0 +1,8 @@
package com.bsd.pjcloud.wallet.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.bsd.pjcloud.wallet.api.entity.WalletFreezeEntity;
public interface WalletFreezeService extends IService<WalletFreezeEntity> {
}
@@ -0,0 +1,16 @@
package com.bsd.pjcloud.wallet.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bsd.pjcloud.wallet.api.entity.WalletActiveEntity;
import com.bsd.pjcloud.wallet.mapper.WalletActiveMapper;
import com.bsd.pjcloud.wallet.service.WalletActiveService;
import org.springframework.stereotype.Service;
/**
* 钱包开卡
*
* @author dzc
* @date 2024-12-31 18:53:31
*/
@Service
public class WalletActiveServiceImpl extends ServiceImpl<WalletActiveMapper, WalletActiveEntity> implements WalletActiveService {
}
@@ -0,0 +1,16 @@
package com.bsd.pjcloud.wallet.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bsd.pjcloud.wallet.api.entity.WalletFreezeEntity;
import com.bsd.pjcloud.wallet.mapper.WalletFreezeMapper;
import com.bsd.pjcloud.wallet.service.WalletFreezeService;
import org.springframework.stereotype.Service;
/**
* 饭卡冻结记录表
*
* @author dzc
* @date 2024-12-31 18:54:43
*/
@Service
public class WalletFreezeServiceImpl extends ServiceImpl<WalletFreezeMapper, WalletFreezeEntity> implements WalletFreezeService {
}
@@ -0,0 +1,22 @@
<?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="com.bsd.pjcloud.wallet.mapper.WalletActiveMapper">
<resultMap id="walletActiveMap" type="com.bsd.pjcloud.wallet.api.entity.WalletActiveEntity">
<id property="id" column="id"/>
<result property="userId" column="user_id"/>
<result property="walletId" column="wallet_id"/>
<result property="walletTypeId" column="wallet_type_id"/>
<result property="deptId" column="dept_id"/>
<result property="merchantId" column="merchant_id"/>
<result property="cardNumber" column="card_number"/>
<result property="isActiveHardware" column="is_active_hardware"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="delFlag" column="del_flag"/>
<result property="tenantId" column="tenant_id"/>
</resultMap>
</mapper>
@@ -0,0 +1,19 @@
<?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="com.bsd.pjcloud.wallet.mapper.WalletFreezeMapper">
<resultMap id="walletFreezeMap" type="com.bsd.pjcloud.wallet.api.entity.WalletFreezeEntity">
<id property="id" column="id"/>
<result property="walletId" column="wallet_id"/>
<result property="userId" column="user_id"/>
<result property="freeStatus" column="free_status"/>
<result property="remark" column="remark"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="delFlag" column="del_flag"/>
<result property="tenantId" column="tenant_id"/>
</resultMap>
</mapper>