Merge remote-tracking branch 'origin/master'

This commit is contained in:
zjf committed 2025-01-02 17:59:38 +08:00
commit 7d8871dc17
45 files changed
+1077 -88

No files matched your search

-28
View File
@@ -1,28 +0,0 @@
-- mch 商户管理
create database `pjcloudx_mch` default character set utf8mb4 collate utf8mb4_general_ci;
DROP TABLE IF EXISTS `mch_manage`;
CREATE TABLE mch_manage
(
id bigint NOT NULL COMMENT '主键',
dept_id bigint NOT NULL COMMENT '绑定的部门id',
name varchar(64) NOT NULL COMMENT '商户名',
types varchar(64) NOT NULL COMMENT '店铺类型,逗号分隔',
logo_pic varchar(256) NOT NULL COMMENT '商户logo图片',
collection_code varchar(256) DEFAULT '' COMMENT '商户收款码,自动生成',
swiper_pic text DEFAULT NULL COMMENT '商户轮播图,逗号分隔',
phone varchar(128) DEFAULT '' COMMENT '商户手机号',
job_start_time timestamp DEFAULT NULL COMMENT '商户开始营业时间',
job_end_time timestamp DEFAULT NULL COMMENT '商户结束营业时间',
address_des varchar(256) DEFAULT NULL 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 '修改人',
update_time datetime DEFAULT NULL COMMENT '修改时间',
del_flag char(1) COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记',
tenant_id bigint DEFAULT NULL COMMENT '租户ID',
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT ='商户管理';
CREATE INDEX idx_dept_id ON mch_manage (dept_id);
+89 -9
View File
@@ -15,8 +15,8 @@ CREATE TABLE mch_manage
collection_code varchar(256) DEFAULT '' COMMENT '商户收款码,自动生成',
swiper_pic text DEFAULT NULL COMMENT '商户轮播图,逗号分隔',
phone varchar(128) DEFAULT '' COMMENT '商户手机号',
job_start_time timestamp DEFAULT NULL COMMENT '商户开始营业时间',
job_end_time timestamp DEFAULT NULL COMMENT '商户结束营业时间',
job_start_time time DEFAULT NULL COMMENT '商户开始营业时间',
job_end_time time DEFAULT NULL COMMENT '商户结束营业时间',
address_des varchar(256) DEFAULT NULL COMMENT '商户地址',
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
create_time datetime DEFAULT NULL COMMENT '创建时间',
@@ -88,9 +88,9 @@ DROP TABLE IF EXISTS wallet_active;
CREATE TABLE wallet_active
(
id bigint NOT NULL COMMENT '主键',
user_id bigint NOT NULL COMMENT '用户id',
wallet_id bigint NOT NULL COMMENT '钱包id',
wallet_type_id bigint NOT NULL COMMENT '饭卡类型id',
user_id bigint DEFAULT NULL COMMENT '用户id',
wallet_id bigint DEFAULT NULL COMMENT '钱包id',
wallet_type_id bigint DEFAULT NULL COMMENT '饭卡类型id',
dept_id bigint NOT NULL COMMENT '部门id',
merchant_id bigint NOT NULL COMMENT '商户id',
card_number varchar(128) NOT NULL COMMENT '用户卡号',
@@ -106,7 +106,6 @@ 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 (dept_id);
-- ----------------------------
-- Table structure for wallet_freeze
@@ -154,7 +153,10 @@ CREATE TABLE wallet_transaction
CREATE INDEX idx_dept_id ON wallet_transaction (wallet_id);
-- ----------------------------
-- Table structure for sys_user_face
-- ----------------------------
DROP TABLE IF EXISTS sys_user_face;
CREATE TABLE `sys_user_face`
(
id bigint AUTO_INCREMENT NOT NULL COMMENT '编号',
@@ -172,6 +174,10 @@ CREATE TABLE `sys_user_face`
COLLATE = utf8mb4_general_ci COMMENT ='人脸样本表';
CREATE INDEX idx_dept_id ON sys_user_face (user_id);
-- ----------------------------
-- Table structure for wallet_recharge_apply
-- ----------------------------
DROP TABLE IF EXISTS wallet_recharge_apply;
CREATE TABLE wallet_recharge_apply
(
id bigint NOT NULL COMMENT '主键ID',
@@ -193,10 +199,14 @@ CREATE TABLE wallet_recharge_apply
COLLATE = utf8mb4_general_ci COMMENT ='充值申请表';
CREATE INDEX idx_dept_id ON wallet_recharge_apply (user_id);
-- ----------------------------
-- Table structure for wallet_recharge_import
-- ----------------------------
DROP TABLE IF EXISTS wallet_recharge_import;
CREATE TABLE wallet_recharge_import
(
id bigint NOT NULL COMMENT '编号',
user_id bigint NOT NULL COMMENT '用户id',
user_id bigint default NULL COMMENT '用户id',
apply_id bigint NOT NULL COMMENT '申请id',
before_price int DEFAULT NULL COMMENT '导入前的金额',
price int NOT NULL COMMENT '交易金额, 单位分',
@@ -208,4 +218,74 @@ CREATE TABLE wallet_recharge_import
tenant_id bigint DEFAULT NULL COMMENT '租户ID',
PRIMARY KEY (id)
) COMMENT ='充值导入表';
CREATE INDEX idx_dept_id ON wallet_recharge_import (user_id);
CREATE INDEX idx_dept_id ON wallet_recharge_import (user_id);
-- ----------------------------
-- Table structure for wallet_stride_dept
-- ----------------------------
DROP TABLE IF EXISTS wallet_stride;
CREATE TABLE wallet_stride
(
id bigint NOT NULL COMMENT '编号',
dept_id bigint NOT NULL COMMENT '部门id',
count int NOT NULL COMMENT '申请数量',
use_count int NOT NULL COMMENT '使用数量',
user_id bigint NOT NULL COMMENT '申请人id',
remark varchar(1024) 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 '修改人',
update_time datetime DEFAULT NULL COMMENT '修改时间',
del_flag char(1) COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记',
tenant_id bigint DEFAULT NULL COMMENT '租户ID',
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 COMMENT ='跨单位就餐';
-- ----------------------------
-- Table structure for wallet_recharge_import
-- ----------------------------
DROP TABLE IF EXISTS wallet_foreign;
CREATE TABLE wallet_foreign
(
id bigint NOT NULL COMMENT '编号',
user_id bigint NOT NULL COMMENT '用户id',
dept_id bigint NOT NULL COMMENT '部门id',
apply_start_time date NULL COMMENT '申请使用开始时间',
apply_end_time date NULL COMMENT '申请使用结束时间',
count int NOT NULL COMMENT '申请数量',
use_count int NOT NULL COMMENT '使用数量',
remark VARCHAR(1024) 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 '修改人',
update_time datetime DEFAULT NULL COMMENT '修改时间',
del_flag char(1) COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记',
tenant_id bigint DEFAULT NULL COMMENT '租户ID',
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 COMMENT ='外来人员电子餐券表';
-- ----------------------------
-- Table structure for wallet_code_use
-- ----------------------------
DROP TABLE IF EXISTS wallet_code_use;
CREATE TABLE wallet_code_use
(
id bigint NOT NULL COMMENT '编号',
user_id bigint NOT NULL COMMENT '用户id',
biz_type tinytext NOT NULL COMMENT '类型',
biz_id bigint NOT NULL COMMENT '类型关联id',
status char(1) DEFAULT '0' NOT NULL COMMENT '是否使用',
code varchar(1024) DEFAULT NULL COMMENT '二维码',
code_content varchar(1024) DEFAULT NULL COMMENT '二维码内容',
use_time timestamp NULL 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 '修改人',
update_time datetime DEFAULT NULL COMMENT '修改时间',
del_flag char(1) COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记',
tenant_id bigint DEFAULT NULL COMMENT '租户ID',
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 COMMENT ='二维码使用表';
@@ -16,4 +16,6 @@ public class MchManageDto extends MchManageEntity {
private List<Long> deptIds;
private List<Long> ids;
}
@@ -7,6 +7,8 @@ import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.util.List;
@Data
public class WalletActiveDto extends WalletActiveEntity {
@@ -19,7 +21,7 @@ public class WalletActiveDto extends WalletActiveEntity {
@NotNull(message = "商户id不能为空")
private Long merchantId;
@NotNull(message = "钱包类型id不能为空")
private Long walletTypeId;
private List<Long> userIds;
}
@@ -0,0 +1,8 @@
package com.bsd.pjcloud.wallet.api.dto;
import com.bsd.pjcloud.wallet.api.entity.WalletCodeUseEntity;
import lombok.Data;
@Data
public class WalletCodeUseDto extends WalletCodeUseEntity {
}
@@ -0,0 +1,15 @@
package com.bsd.pjcloud.wallet.api.dto;
import com.bsd.pjcloud.wallet.api.entity.WalletFreezeEntity;
import lombok.Data;
import java.util.List;
@Data
public class WalletFreezeDto extends WalletFreezeEntity {
private List<Long> userIds;
private String cardNumber;
}
@@ -1,8 +0,0 @@
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,8 @@
package com.bsd.pjcloud.wallet.api.dto;
import com.bsd.pjcloud.wallet.api.entity.WalletStrideEntity;
import lombok.Data;
@Data
public class WalletStrideDto extends WalletStrideEntity {
}
@@ -1,12 +1,15 @@
package com.bsd.pjcloud.wallet.api.entity;
import cn.hutool.core.date.DatePattern;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
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;
import java.time.LocalTime;
/**
* 商户管理
@@ -75,13 +78,15 @@ public class MchManageEntity extends Model<MchManageEntity> {
* 商户开始营业时间
*/
@Schema(description="商户开始营业时间")
private LocalDateTime jobStartTime;
@JsonFormat(pattern = DatePattern.NORM_TIME_PATTERN)
private LocalTime jobStartTime;
/**
* 商户结束营业时间
*/
@Schema(description="商户结束营业时间")
private LocalDateTime jobEndTime;
@JsonFormat(pattern = DatePattern.NORM_TIME_PATTERN)
private LocalTime jobEndTime;
/**
* 商户地址
@@ -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 2025-01-02 16:26:10
*/
@Data
@TenantTable
@TableName("wallet_code_use")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "二维码使用表")
public class WalletCodeUseEntity extends Model<WalletCodeUseEntity> {
/**
* 编号
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description="编号")
private Long id;
/**
* 用户id
*/
@Schema(description="用户id")
private Long userId;
/**
* 类型
*/
@Schema(description="类型")
private String bizType;
/**
* 类型关联id
*/
@Schema(description="类型关联id")
private Long bizId;
/**
* 是否使用
*/
@Schema(description="是否使用")
private String status;
/**
* 二维码
*/
@Schema(description="二维码")
private String code;
/**
* 二维码内容
*/
@Schema(description="二维码内容")
private String codeContent;
/**
* 使用时间
*/
@Schema(description="使用时间")
private LocalDateTime useTime;
/**
* 创建人
*/
@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,116 @@
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.LocalDate;
import java.time.LocalDateTime;
/**
* 外来人员电子餐券表
*
* @author dzc
* @date 2025-01-02 16:26:48
*/
@Data
@TenantTable
@TableName("wallet_foreign")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "外来人员电子餐券表")
public class WalletForeignEntity extends Model<WalletForeignEntity> {
/**
* 编号
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description="编号")
private Long id;
/**
* 用户id
*/
@Schema(description="用户id")
private Long userId;
/**
* 部门id
*/
@Schema(description="部门id")
private Long deptId;
/**
* 申请使用开始时间
*/
@Schema(description="申请使用开始时间")
private LocalDate applyStartTime;
/**
* 申请使用结束时间
*/
@Schema(description="申请使用结束时间")
private LocalDate applyEndTime;
/**
* 申请数量
*/
@Schema(description="申请数量")
private Integer count;
/**
* 使用数量
*/
@Schema(description="使用数量")
private Integer useCount;
/**
* 申请备注
*/
@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,103 @@
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 pjcloud
* @date 2025-01-02 16:27:26
*/
@Data
@TenantTable
@TableName("wallet_stride")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "跨单位就餐")
public class WalletStrideEntity extends Model<WalletStrideEntity> {
/**
* 编号
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description="编号")
private Long id;
/**
* 部门id
*/
@Schema(description="部门id")
private Long deptId;
/**
* 申请数量
*/
@Schema(description="申请数量")
private Integer count;
/**
* 使用数量
*/
@Schema(description="使用数量")
private Integer useCount;
/**
* 申请人id
*/
@Schema(description="申请人id")
private Long userId;
/**
* 备注
*/
@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;
}
@@ -5,6 +5,7 @@ import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.feign.annotation.NoToken;
import com.bsd.pjcloud.wallet.api.constant.WalletTypeCodeEnum;
import com.bsd.pjcloud.wallet.api.dto.MchManageDto;
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
@@ -16,18 +17,18 @@ public interface RemoteMchService {
@NoToken
@GetMapping("/get-by-id")
R<MchManageDto> getById(@RequestParam Long id);
R<MchManageVo> getById(@RequestParam Long id);
@NoToken
@GetMapping("/get-by-ids")
R<List<MchManageDto>> getByIds(@RequestParam List<Long> ids);
R<List<MchManageVo>> getByIds(@RequestParam List<Long> ids);
@NoToken
@GetMapping("/get-by-dept-id")
R<MchManageDto> getByDeptId(@RequestParam Long deptId);
R<MchManageVo> getByDeptId(@RequestParam Long deptId);
@NoToken
@GetMapping("/get-first-mch")
R<MchManageDto> getFirstMch(@RequestParam List<Long> deptIds);
R<MchManageVo> getFirstMch(@RequestParam List<Long> deptIds);
}
@@ -0,0 +1,27 @@
package com.bsd.pjcloud.wallet.api.utils;
import cn.hutool.core.util.ObjectUtil;
import com.bsd.pjcloud.admin.api.entity.SysUser;
import com.bsd.pjcloud.admin.api.vo.base.BaseUserInterface;
import com.bsd.pjcloud.common.core.util.CollectionUtils;
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
import com.bsd.pjcloud.wallet.api.vo.base.BaseMchInterface;
import lombok.experimental.UtilityClass;
import java.util.List;
import java.util.Map;
@UtilityClass
public class MchDataUtil {
public <T extends BaseMchInterface> List<T> convertMchList(List<T> list, Map<Long, MchManageVo> map) {
return CollectionUtils.convertList(list, v -> convertMch(v, map.get(v.getMerchantId())));
}
public <T extends BaseMchInterface> T convertMch(T v, MchManageVo vo) {
if (ObjectUtil.isEmpty(vo)) return v;
v.setMerchantName(vo.getName());
return v;
}
}
@@ -1,8 +1,30 @@
package com.bsd.pjcloud.wallet.api.vo;
import com.bsd.pjcloud.admin.api.vo.base.BaseDeptInterface;
import com.bsd.pjcloud.admin.api.vo.base.BaseUserInterface;
import com.bsd.pjcloud.wallet.api.entity.WalletActiveEntity;
import com.bsd.pjcloud.wallet.api.vo.base.BaseMchInterface;
import lombok.Data;
@Data
public class WalletActiveVo extends WalletActiveEntity {
public class WalletActiveVo extends WalletActiveEntity implements BaseUserInterface, BaseDeptInterface, BaseMchInterface {
/**
* 用户相关
*/
private String username;
private String userMobile;
private String userAvatar;
/**
* 部门相关
*/
private String deptName;
/**
* 商户相关
*/
private String merchantName;
}
@@ -0,0 +1,8 @@
package com.bsd.pjcloud.wallet.api.vo;
import com.bsd.pjcloud.wallet.api.entity.WalletCodeUseEntity;
import lombok.Data;
@Data
public class WalletCodeUseVo extends WalletCodeUseEntity {
}
@@ -0,0 +1,9 @@
package com.bsd.pjcloud.wallet.api.vo;
import com.bsd.pjcloud.wallet.api.entity.WalletForeignEntity;
import lombok.Data;
@Data
public class WalletForeignVo extends WalletForeignEntity {
}
@@ -1,8 +1,27 @@
package com.bsd.pjcloud.wallet.api.vo;
import com.bsd.pjcloud.admin.api.vo.base.BaseDeptInterface;
import com.bsd.pjcloud.admin.api.vo.base.BaseUserInterface;
import com.bsd.pjcloud.wallet.api.entity.WalletFreezeEntity;
import lombok.Data;
@Data
public class WalletFreezeVo extends WalletFreezeEntity {
public class WalletFreezeVo extends WalletFreezeEntity implements BaseUserInterface, BaseDeptInterface {
/**
* 用户相关
*/
private String username;
private String userMobile;
private String userAvatar;
/**
* 部门相关
*/
private Long deptId;
private String deptName;
private String cardNumber;
}
@@ -0,0 +1,9 @@
package com.bsd.pjcloud.wallet.api.vo;
import com.bsd.pjcloud.wallet.api.entity.WalletStrideEntity;
import lombok.Data;
@Data
public class WalletStrideVo extends WalletStrideEntity {
}
@@ -0,0 +1,19 @@
package com.bsd.pjcloud.wallet.api.vo.base;
public interface BaseMchInterface {
/**
* 商户id
*/
Long getMerchantId();
void setMerchantId(Long dchId);
/**
* 商户名
*/
String getMerchantName();
void setMerchantName(String dchName);
}
@@ -10,10 +10,8 @@ import com.bsd.pjcloud.common.core.util.BeanUtils;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.log.annotation.SysLog;
import com.bsd.pjcloud.common.security.annotation.Inner;
import com.bsd.pjcloud.wallet.api.constant.WalletTypeCodeEnum;
import com.bsd.pjcloud.wallet.api.dto.MchManageDto;
import com.bsd.pjcloud.wallet.api.entity.MchManageEntity;
import com.bsd.pjcloud.wallet.api.entity.WalletManageEntity;
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
import com.bsd.pjcloud.wallet.service.MchManageService;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -42,37 +40,37 @@ import java.util.List;
public class MchManageController {
private final MchManageService mchManageService;
/* ************************************* start 远程调用 start ************************************* */
@Inner
@GetMapping("/get-by-id")
public R<MchManageDto> getById(@RequestParam Long id) {
public R<MchManageVo> getById(@RequestParam Long id) {
MchManageEntity mchManage = mchManageService.getById(id);
if (ObjectUtil.isEmpty(mchManage)) return R.failed("商户不存在");
return R.ok(BeanUtils.toBean(mchManage, MchManageDto.class));
return R.ok(BeanUtils.toBean(mchManage, MchManageVo.class));
}
@Inner
@GetMapping("/get-by-ids")
public R<List<MchManageDto>> getByIds(@RequestParam List<Long> ids) {
Page<MchManageVo> page = mchManageService.pageJoin(new Page<>(), MchManageDto.builder().deptIds(ids).build());
if (ObjectUtil.isAllNotEmpty(page, page.getRecords())) return R.failed("商户不存在");
return R.ok(BeanUtils.toBean(page.getRecords(), MchManageDto.class));
public R<List<MchManageVo>> getByIds(@RequestParam List<Long> ids) {
List<MchManageVo> list = mchManageService.list(MchManageDto.builder().deptIds(ids).build());
if (ObjectUtil.isAllNotEmpty(list)) return R.failed("商户不存在");
return R.ok(list);
}
@Inner
@GetMapping("/get-by-dept-id")
public R<MchManageDto> getByDeptId(@RequestParam Long deptId) {
MchManageDto mchManage = mchManageService.getByDeptId(deptId);
public R<MchManageVo> getByDeptId(@RequestParam Long deptId) {
MchManageVo mchManage = mchManageService.getByDeptId(deptId);
if (ObjectUtil.isEmpty(mchManage)) return R.failed("商户不存在");
return R.ok(mchManage);
}
@Inner
@GetMapping("/get-first-mch")
public R<MchManageDto> getFirstMch(@RequestParam List<Long> deptIds) {
MchManageDto mchManage = mchManageService.getFirstMch(deptIds);
public R<MchManageVo> getFirstMch(@RequestParam List<Long> deptIds) {
MchManageVo mchManage = mchManageService.getFirstMch(deptIds);
if (ObjectUtil.isEmpty(mchManage)) return R.failed("商户不存在");
return R.ok(mchManage);
}
@@ -11,6 +11,7 @@ import com.bsd.pjcloud.common.log.annotation.SysLog;
import com.bsd.pjcloud.wallet.api.dto.WalletActiveDto;
import com.bsd.pjcloud.wallet.api.entity.WalletActiveEntity;
import com.bsd.pjcloud.wallet.service.WalletActiveService;
import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize;
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
@@ -23,8 +24,6 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
/**
* 钱包开卡
@@ -45,7 +44,7 @@ public class WalletActiveController {
@PostMapping("/fast-create-card")
@Operation(summary = "一键开卡")
@Idempotent(info = "正在开卡中,请勿重复提交")
public R<Boolean> fastCreateCard(WalletActiveDto dto) {
public R<Boolean> fastCreateCard(@Valid @RequestBody WalletActiveDto dto) {
walletActiveService.fastCreateCard(dto);
return R.ok(true);
}
@@ -65,6 +64,20 @@ public class WalletActiveController {
return R.ok(walletActiveService.page(page, wrapper));
}
/**
* 分页复杂查询
*
* @param page 分页对象
* @param walletActive 钱包开卡
* @return
*/
@Operation(summary = "分页复杂查询", description = "分页复杂查询")
@GetMapping("/page-join")
@PreAuthorize("@pms.hasPermission('wallet_walletActive_view')")
public R getWalletActivePageJoin(@ParameterObject Page page, @ParameterObject WalletActiveDto dto) {
return R.ok(walletActiveService.pageJoin(page, dto));
}
/**
* 通过id查询钱包开卡
@@ -7,6 +7,7 @@ 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.dto.WalletFreezeDto;
import com.bsd.pjcloud.wallet.api.entity.WalletFreezeEntity;
import com.bsd.pjcloud.wallet.service.WalletFreezeService;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -50,6 +51,19 @@ public class WalletFreezeController {
return R.ok(walletFreezeService.page(page, wrapper));
}
/**
* 分页复杂查询
* @param page 分页复杂查询
* @param dto 分页复杂查询
* @return
*/
@Operation(summary = "分页复杂查询" , description = "分页复杂查询" )
@GetMapping("/page-join" )
@PreAuthorize("@pms.hasPermission('wallet_walletFreeze_view')" )
public R getWalletFreezePage(@ParameterObject Page page, @ParameterObject WalletFreezeDto dto) {
return R.ok(walletFreezeService.pageJoin(page, dto));
}
/**
* 通过id查询饭卡冻结记录表
@@ -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.WalletStrideEntity;
import com.bsd.pjcloud.wallet.service.WalletStrideService;
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 pjcloud
* @date 2025-01-02 16:27:26
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/walletStride" )
@Tag(description = "walletStride" , name = "跨单位就餐管理" )
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class WalletStrideController {
private final WalletStrideService walletStrideService;
/**
* 分页查询
* @param page 分页对象
* @param walletStride 跨单位就餐
* @return
*/
@Operation(summary = "分页查询" , description = "分页查询" )
@GetMapping("/page" )
@PreAuthorize("@pms.hasPermission('admin_walletStride_view')" )
public R getWalletStridePage(@ParameterObject Page page, @ParameterObject WalletStrideEntity walletStride) {
LambdaQueryWrapper<WalletStrideEntity> wrapper = Wrappers.lambdaQuery();
return R.ok(walletStrideService.page(page, wrapper));
}
/**
* 通过id查询跨单位就餐
* @param id id
* @return R
*/
@Operation(summary = "通过id查询" , description = "通过id查询" )
@GetMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('admin_walletStride_view')" )
public R getById(@PathVariable("id" ) Long id) {
return R.ok(walletStrideService.getById(id));
}
/**
* 新增跨单位就餐
* @param walletStride 跨单位就餐
* @return R
*/
@Operation(summary = "新增跨单位就餐" , description = "新增跨单位就餐" )
@SysLog("新增跨单位就餐" )
@PostMapping
@PreAuthorize("@pms.hasPermission('admin_walletStride_add')" )
public R save(@RequestBody WalletStrideEntity walletStride) {
return R.ok(walletStrideService.save(walletStride));
}
/**
* 修改跨单位就餐
* @param walletStride 跨单位就餐
* @return R
*/
@Operation(summary = "修改跨单位就餐" , description = "修改跨单位就餐" )
@SysLog("修改跨单位就餐" )
@PutMapping
@PreAuthorize("@pms.hasPermission('admin_walletStride_edit')" )
public R updateById(@RequestBody WalletStrideEntity walletStride) {
return R.ok(walletStrideService.updateById(walletStride));
}
/**
* 通过id删除跨单位就餐
* @param ids id列表
* @return R
*/
@Operation(summary = "通过id删除跨单位就餐" , description = "通过id删除跨单位就餐" )
@SysLog("通过id删除跨单位就餐" )
@DeleteMapping
@PreAuthorize("@pms.hasPermission('admin_walletStride_del')" )
public R removeById(@RequestBody Long[] ids) {
return R.ok(walletStrideService.removeBatchByIds(CollUtil.toList(ids)));
}
/**
* 导出excel 表格
* @param walletStride 查询条件
* @param ids 导出指定ID
* @return excel 文件流
*/
@ResponseExcel
@GetMapping("/export")
@PreAuthorize("@pms.hasPermission('admin_walletStride_export')" )
public List<WalletStrideEntity> export(WalletStrideEntity walletStride,Long[] ids) {
return walletStrideService.list(Wrappers.lambdaQuery(walletStride).in(ArrayUtil.isNotEmpty(ids), WalletStrideEntity::getId, ids));
}
}
@@ -1,5 +1,6 @@
package com.bsd.pjcloud.wallet.mapper;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
import com.bsd.pjcloud.wallet.api.dto.MchManageDto;
@@ -8,6 +9,8 @@ import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
import com.github.yulichang.query.MPJLambdaQueryWrapper;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface MchManageMapper extends PjcloudBaseMapper<MchManageEntity> {
@@ -15,7 +18,17 @@ public interface MchManageMapper extends PjcloudBaseMapper<MchManageEntity> {
default Page<MchManageVo> pageJoin(Page page, MchManageDto dto) {
MPJLambdaQueryWrapper<MchManageEntity> wrapper = new MPJLambdaQueryWrapper<MchManageEntity>()
.selectAll(MchManageEntity.class)
.likeIfExists(MchManageEntity::getName, dto.getName());
.likeIfExists(MchManageEntity::getName, dto.getName())
.in(ObjectUtil.isNotEmpty(dto.getDeptIds()), MchManageEntity::getDeptId, dto.getDeptIds());
return selectJoinPage(page, MchManageVo.class, wrapper);
}
default List<MchManageVo> list(MchManageDto dto) {
MPJLambdaQueryWrapper<MchManageEntity> wrapper = new MPJLambdaQueryWrapper<MchManageEntity>()
.selectAll(MchManageEntity.class)
.likeIfExists(MchManageEntity::getName, dto.getName())
.in(ObjectUtil.isNotEmpty(dto.getDeptIds()), MchManageEntity::getDeptId, dto.getDeptIds())
.in(ObjectUtil.isNotEmpty(dto.getIds()), MchManageEntity::getId, dto.getIds());
return selectJoinList(MchManageVo.class, wrapper);
}
}
@@ -1,11 +1,23 @@
package com.bsd.pjcloud.wallet.mapper;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
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 com.github.yulichang.query.MPJLambdaQueryWrapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface WalletActiveMapper extends PjcloudBaseMapper<WalletActiveEntity> {
default Page<WalletActiveVo> pageJoin(Page page, WalletActiveDto dto) {
MPJLambdaQueryWrapper<WalletActiveEntity> wrapper = new MPJLambdaQueryWrapper<WalletActiveEntity>()
.selectAll(WalletActiveEntity.class)
.likeIfExists(WalletActiveEntity::getCardNumber, dto.getCardNumber())
.eqIfExists(WalletActiveEntity::getIsActiveHardware, dto.getIsActiveHardware())
.in(ObjectUtil.isNotEmpty(dto.getUserIds()), WalletActiveEntity::getId, dto.getUserIds());
return selectJoinPage(page, WalletActiveVo.class, wrapper);
}
}
@@ -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.WalletCodeUseEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface WalletCodeUseMapper extends PjcloudBaseMapper<WalletCodeUseEntity> {
}
@@ -0,0 +1,10 @@
package com.bsd.pjcloud.wallet.mapper;
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
import com.bsd.pjcloud.wallet.api.entity.WalletForeignEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface WalletForeignMapper extends PjcloudBaseMapper<WalletForeignEntity> {
}
@@ -1,11 +1,28 @@
package com.bsd.pjcloud.wallet.mapper;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
import com.bsd.pjcloud.wallet.api.dto.WalletFreezeDto;
import com.bsd.pjcloud.wallet.api.entity.WalletActiveEntity;
import com.bsd.pjcloud.wallet.api.entity.WalletFreezeEntity;
import com.bsd.pjcloud.wallet.api.entity.WalletManageEntity;
import com.bsd.pjcloud.wallet.api.vo.WalletActiveVo;
import com.bsd.pjcloud.wallet.api.vo.WalletFreezeVo;
import com.github.yulichang.query.MPJLambdaQueryWrapper;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface WalletFreezeMapper extends PjcloudBaseMapper<WalletFreezeEntity> {
default Page<WalletFreezeVo> pageJoin(Page page, WalletFreezeDto dto) {
MPJLambdaWrapper<WalletFreezeEntity> wrapper = new MPJLambdaWrapper<WalletFreezeEntity>()
.selectAll(WalletFreezeEntity.class)
.selectAs(WalletManageEntity::getCardNumber, WalletFreezeDto::getCardNumber)
.leftJoin(WalletManageEntity.class, WalletManageEntity::getId, WalletFreezeEntity::getWalletId)
.eqIfExists(WalletManageEntity::getCardNumber, dto.getCardNumber())
.in(ObjectUtil.isNotEmpty(dto.getUserIds()), WalletFreezeEntity::getId, dto.getUserIds());
return selectJoinPage(page, WalletActiveVo.class, wrapper);
}
}
@@ -0,0 +1,11 @@
package com.bsd.pjcloud.wallet.mapper;
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
import com.bsd.pjcloud.admin.entity.WalletStrideEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface WalletStrideMapper extends PjcloudBaseMapper<WalletStrideEntity> {
}
@@ -19,7 +19,9 @@ public interface MchManageService extends IService<MchManageEntity> {
Page<MchManageVo> pageJoin(Page page, MchManageDto dto);
MchManageDto getByDeptId(Long deptId);
List<MchManageVo> list(MchManageDto dto);
MchManageDto getFirstMch(List<Long> deptIds);
MchManageVo getByDeptId(Long deptId);
MchManageVo getFirstMch(List<Long> deptIds);
}
@@ -1,8 +1,10 @@
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.wallet.api.dto.WalletActiveDto;
import com.bsd.pjcloud.wallet.api.entity.WalletActiveEntity;
import com.bsd.pjcloud.wallet.api.vo.WalletActiveVo;
public interface WalletActiveService extends IService<WalletActiveEntity> {
/**
@@ -11,4 +13,6 @@ public interface WalletActiveService extends IService<WalletActiveEntity> {
* @param dto
*/
void fastCreateCard(WalletActiveDto dto);
Page<WalletActiveVo> pageJoin(Page page, WalletActiveDto dto);
}
@@ -0,0 +1,8 @@
package com.bsd.pjcloud.wallet.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.bsd.pjcloud.wallet.api.entity.WalletCodeUseEntity;
public interface WalletCodeUseService extends IService<WalletCodeUseEntity> {
}
@@ -0,0 +1,8 @@
package com.bsd.pjcloud.wallet.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.bsd.pjcloud.wallet.api.entity.WalletForeignEntity;
public interface WalletForeignService extends IService<WalletForeignEntity> {
}
@@ -1,8 +1,12 @@
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.wallet.api.dto.WalletFreezeDto;
import com.bsd.pjcloud.wallet.api.entity.WalletFreezeEntity;
import com.bsd.pjcloud.wallet.api.vo.WalletFreezeVo;
public interface WalletFreezeService extends IService<WalletFreezeEntity> {
Page<WalletFreezeVo> pageJoin(Page page, WalletFreezeDto dto);
}
@@ -0,0 +1,8 @@
package com.bsd.pjcloud.wallet.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.bsd.pjcloud.wallet.api.entity.WalletStrideEntity;
public interface WalletStrideService extends IService<WalletStrideEntity> {
}
@@ -69,7 +69,7 @@ public class MchManageServiceImpl extends ServiceImpl<MchManageMapper, MchManage
throw new CheckedException("商户名不能重复");
}
if (existDeptId(dto.getDeptId(), null)) {
throw new CheckedException("改部门已经绑定过商户");
throw new CheckedException("该部门已经绑定过商户");
}
baseMapper.insert(dto);
try {
@@ -130,21 +130,26 @@ public class MchManageServiceImpl extends ServiceImpl<MchManageMapper, MchManage
}
@Override
public MchManageDto getByDeptId(Long deptId) {
MchManageEntity mchManage = baseMapper.selectOne(new LambdaQueryWrapper<MchManageEntity>()
.eq(MchManageEntity::getDeptId, deptId)
);
return BeanUtils.toBean(mchManage, MchManageDto.class);
public List<MchManageVo> list(MchManageDto dto) {
return baseMapper.list(dto);
}
@Override
public MchManageDto getFirstMch(List<Long> deptIds) {
public MchManageVo getByDeptId(Long deptId) {
MchManageEntity mchManage = baseMapper.selectOne(new LambdaQueryWrapper<MchManageEntity>()
.eq(MchManageEntity::getDeptId, deptId)
);
return BeanUtils.toBean(mchManage, MchManageVo.class);
}
@Override
public MchManageVo getFirstMch(List<Long> deptIds) {
List<MchManageEntity> merchantList = baseMapper.selectList(new LambdaQueryWrapper<MchManageEntity>());
if (ObjectUtil.isEmpty(merchantList)) return null;
for (Long id : deptIds) {
for (MchManageEntity merchant : merchantList) {
if (ObjectUtil.equals(merchant.getDeptId(), id)) {
return BeanUtils.toBean(merchant, MchManageDto.class);
return BeanUtils.toBean(merchant, MchManageVo.class);
}
}
}
@@ -3,14 +3,29 @@ 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;
import com.bsd.pjcloud.admin.api.entity.SysUser;
import com.bsd.pjcloud.admin.api.feign.RemoteDeptService;
import com.bsd.pjcloud.admin.api.feign.RemoteUserService;
import com.bsd.pjcloud.admin.api.utils.DataUtil;
import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum;
import com.bsd.pjcloud.common.core.exception.CheckedException;
import com.bsd.pjcloud.wallet.api.constant.WalletTypeEnum;
import com.bsd.pjcloud.common.core.util.CollectionUtils;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.wallet.api.constant.WalletTypeCodeEnum;
import com.bsd.pjcloud.wallet.api.dto.MchManageDto;
import com.bsd.pjcloud.wallet.api.dto.WalletActiveDto;
import com.bsd.pjcloud.wallet.api.entity.MchManageEntity;
import com.bsd.pjcloud.wallet.api.entity.WalletActiveEntity;
import com.bsd.pjcloud.wallet.api.entity.WalletTypeEntity;
import com.bsd.pjcloud.wallet.api.utils.MchDataUtil;
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
import com.bsd.pjcloud.wallet.api.vo.WalletActiveVo;
import com.bsd.pjcloud.wallet.api.vo.WalletManageVo;
import com.bsd.pjcloud.wallet.mapper.WalletActiveMapper;
import com.bsd.pjcloud.wallet.service.MchManageService;
import com.bsd.pjcloud.wallet.service.WalletActiveService;
import com.bsd.pjcloud.wallet.service.WalletTypeService;
import lombok.RequiredArgsConstructor;
@@ -21,6 +36,7 @@ import org.springframework.validation.annotation.Validated;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 钱包开卡
@@ -35,16 +51,21 @@ import java.util.List;
public class WalletActiveServiceImpl extends ServiceImpl<WalletActiveMapper, WalletActiveEntity> implements WalletActiveService {
private final WalletTypeService walletTypeService;
private final MchManageService mchManageService;
private final RemoteUserService userService;
private final RemoteDeptService deptService;
@Override
@Transactional(rollbackFor = Exception.class)
public void fastCreateCard(WalletActiveDto dto) {
Long count = dto.getCount();
// 查询饭卡钱包类型
WalletTypeEntity walletType = walletTypeService.getById(dto.getWalletTypeId());
WalletTypeEntity walletType = walletTypeService.getByUniqueCode(WalletTypeCodeEnum.CANTEEN);
if (ObjectUtil.isEmpty(walletType)) throw new CheckedException("钱包类型不存在");
// 查询商户
MchManageEntity mchManage = mchManageService.getById(dto.getMerchantId());
if (ObjectUtil.isEmpty(mchManage)) throw new CheckedException("商户不存在");
int startNum = 1;
WalletActiveEntity last = getLast();
if (ObjectUtil.isNotEmpty(last)) startNum = last.getCardSort();
@@ -53,16 +74,43 @@ public class WalletActiveServiceImpl extends ServiceImpl<WalletActiveMapper, Wal
startNum += 1;
WalletActiveEntity item = new WalletActiveEntity();
String cardNumber = "hq" + String.format("%06d", startNum) + RandomUtil.randomString(RandomUtil.BASE_CHAR, 4);
item.setCardSort(startNum);
item.setCardNumber(cardNumber);
item.setWalletTypeId(walletType.getId());
item.setDeptId(null);
item.setMerchantId(null);
item.setDeptId(mchManage.getDeptId());
item.setMerchantId(mchManage.getId());
item.setIsActiveHardware(YesNoEnum.NO.getCode());
batchSaveList.add(item);
}
baseMapper.insert(batchSaveList);
}
@Override
public Page<WalletActiveVo> pageJoin(Page page, WalletActiveDto dto) {
Page<WalletActiveVo> list = baseMapper.pageJoin(page, dto);
if (ObjectUtil.isNotEmpty(list.getRecords())) {
// 用户
List<Long> userIds = list.getRecords().stream().map(WalletActiveVo::getUserId).distinct().toList();
R<List<SysUser>> userList = userService.getUserById(new ArrayList<>(userIds));
if (ObjectUtil.isNotEmpty(userList.getData())) {
DataUtil.convertUserList(page.getRecords(), CollectionUtils.convertMap(userList.getData(), SysUser::getUserId));
}
// 部门
List<Long> deptIds = list.getRecords().stream().map(WalletActiveVo::getDeptId).distinct().toList();
R<Map<Long, SysDept>> deptList = deptService.getDeptByDeptIds(deptIds);
if (ObjectUtil.isNotEmpty(deptList.getData())) {
DataUtil.convertDeptList(page.getRecords(), deptList.getData());
}
// 商户
List<Long> mchIds = list.getRecords().stream().map(WalletActiveVo::getMerchantId).distinct().toList();
List<MchManageVo> mchList = mchManageService.list(MchManageDto.builder().ids(mchIds).build());
if (ObjectUtil.isNotEmpty(mchList)) {
MchDataUtil.convertMchList(page.getRecords(), CollectionUtils.convertMap(mchList, MchManageVo::getId));
}
}
return list;
}
private WalletActiveEntity getLast() {
LambdaQueryWrapper<WalletActiveEntity> query = new LambdaQueryWrapper<WalletActiveEntity>();
query.orderByDesc(WalletActiveEntity::getId).last("LIMIT 1");
@@ -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.WalletCodeUseEntity;
import com.bsd.pjcloud.wallet.mapper.WalletCodeUseMapper;
import com.bsd.pjcloud.wallet.service.WalletCodeUseService;
import org.springframework.stereotype.Service;
/**
* 二维码使用表
*
* @author dzc
* @date 2025-01-02 16:26:10
*/
@Service
public class WalletCodeUseServiceImpl extends ServiceImpl<WalletCodeUseMapper, WalletCodeUseEntity> implements WalletCodeUseService {
}
@@ -0,0 +1,18 @@
package com.bsd.pjcloud.wallet.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bsd.pjcloud.wallet.api.entity.WalletForeignEntity;
import com.bsd.pjcloud.wallet.mapper.WalletForeignMapper;
import com.bsd.pjcloud.wallet.service.WalletForeignService;
import org.springframework.stereotype.Service;
/**
* 外来人员电子餐券表
*
* @author dzc
* @date 2025-01-02 16:26:48
*/
@Service
public class WalletForeignServiceImpl extends ServiceImpl<WalletForeignMapper, WalletForeignEntity> implements WalletForeignService {
}
@@ -1,7 +1,19 @@
package com.bsd.pjcloud.wallet.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bsd.pjcloud.admin.api.entity.SysDept;
import com.bsd.pjcloud.admin.api.entity.SysUser;
import com.bsd.pjcloud.admin.api.feign.RemoteDeptService;
import com.bsd.pjcloud.admin.api.feign.RemoteUserService;
import com.bsd.pjcloud.admin.api.utils.DataUtil;
import com.bsd.pjcloud.common.core.util.CollectionUtils;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.wallet.api.dto.WalletFreezeDto;
import com.bsd.pjcloud.wallet.api.entity.WalletFreezeEntity;
import com.bsd.pjcloud.wallet.api.vo.WalletActiveVo;
import com.bsd.pjcloud.wallet.api.vo.WalletFreezeVo;
import com.bsd.pjcloud.wallet.mapper.WalletFreezeMapper;
import com.bsd.pjcloud.wallet.service.WalletFreezeService;
import lombok.RequiredArgsConstructor;
@@ -9,6 +21,10 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 饭卡冻结记录表
*
@@ -20,4 +36,28 @@ import org.springframework.validation.annotation.Validated;
@RequiredArgsConstructor
@Service
public class WalletFreezeServiceImpl extends ServiceImpl<WalletFreezeMapper, WalletFreezeEntity> implements WalletFreezeService {
private final RemoteUserService userService;
private final RemoteDeptService deptService;
@Override
public Page<WalletFreezeVo> pageJoin(Page page, WalletFreezeDto dto) {
Page<WalletFreezeVo> list = baseMapper.pageJoin(page, dto);
if (ObjectUtil.isNotEmpty(list.getRecords())) {
// 用户
List<Long> userIds = list.getRecords().stream().map(WalletFreezeVo::getUserId).distinct().toList();
R<List<SysUser>> userList = userService.getUserById(new ArrayList<>(userIds));
if (ObjectUtil.isNotEmpty(userList.getData())) {
DataUtil.convertUserList(page.getRecords(), CollectionUtils.convertMap(userList.getData(), SysUser::getUserId));
}
// 部门
List<Long> deptIds = list.getRecords().stream().map(WalletFreezeVo::getDeptId).distinct().toList();
R<Map<Long, SysDept>> deptList = deptService.getDeptByDeptIds(deptIds);
if (ObjectUtil.isNotEmpty(deptList.getData())) {
DataUtil.convertDeptList(page.getRecords(), deptList.getData());
}
}
return list;
}
}
@@ -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.WalletStrideEntity;
import com.bsd.pjcloud.wallet.mapper.WalletStrideMapper;
import com.bsd.pjcloud.wallet.service.WalletStrideService;
import org.springframework.stereotype.Service;
/**
* 跨单位就餐
*
* @author pjcloud
* @date 2025-01-02 16:27:26
*/
@Service
public class WalletStrideServiceImpl extends ServiceImpl<WalletStrideMapper, WalletStrideEntity> implements WalletStrideService {
}
@@ -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.WalletCodeUseMapper">
<resultMap id="walletCodeUseMap" type="com.bsd.pjcloud.wallet.api.entity.WalletCodeUseEntity">
<id property="id" column="id"/>
<result property="userId" column="user_id"/>
<result property="bizType" column="biz_type"/>
<result property="bizId" column="biz_id"/>
<result property="status" column="status"/>
<result property="code" column="code"/>
<result property="codeContent" column="code_content"/>
<result property="useTime" column="use_time"/>
<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,21 @@
<?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.WalletForeignMapper">
<resultMap id="walletForeignMap" type="com.bsd.pjcloud.wallet.api.entity.WalletForeignEntity">
<id property="id" column="id"/>
<result property="userId" column="user_id"/>
<result property="deptId" column="dept_id"/>
<result property="applyStartTime" column="apply_start_time"/>
<result property="applyEndTime" column="apply_end_time"/>
<result property="count" column="count"/>
<result property="useCount" column="use_count"/>
<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>
@@ -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.WalletStrideMapper">
<resultMap id="walletStrideMap" type="com.bsd.pjcloud.wallet.api.entity.WalletStrideEntity">
<id property="id" column="id"/>
<result property="deptId" column="dept_id"/>
<result property="count" column="count"/>
<result property="useCount" column="use_count"/>
<result property="userId" column="user_id"/>
<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>