feat:用户tag
This commit is contained in:
1 parent
e09244cdde
commit
d469688ab3
18 files changed
+458
-68
No files matched your search
+52
-24
@@ -1,4 +1,5 @@
|
||||
create database `pjcloudx_wallet` default character set utf8mb4 collate utf8mb4_general_ci;
|
||||
create
|
||||
database `pjcloudx_wallet` default character set utf8mb4 collate utf8mb4_general_ci;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_user_transaction
|
||||
@@ -11,14 +12,11 @@ CREATE TABLE `sys_user_transaction`
|
||||
user_id bigint NOT NULL COMMENT '用户id',
|
||||
biz_id bigint DEFAULT NULL COMMENT '业务id',
|
||||
biz_type varchar(32) NOT NULL COMMENT '业务类型',
|
||||
# 岗位调动字段
|
||||
source_dept_id bigint DEFAULT NULL COMMENT '源部门id',
|
||||
# 岗位调动字段 source_dept_id bigint DEFAULT NULL COMMENT '源部门id',
|
||||
target_dept_id bigint DEFAULT NULL COMMENT '目标部门id',
|
||||
# 离职字段
|
||||
is_wallet_transaction varchar(32) DEFAULT NULL COMMENT '是否离职自动转账',
|
||||
# 离职字段 is_wallet_transaction varchar(32) DEFAULT NULL COMMENT '是否离职自动转账',
|
||||
wallet_transaction_time datetime DEFAULT NULL COMMENT '离职自动转账时间',
|
||||
# 审批字读
|
||||
process_id varchar(256) DEFAULT NULL COMMENT '流程id',
|
||||
# 审批字读 process_id varchar(256) DEFAULT NULL COMMENT '流程id',
|
||||
process_status varchar(10) DEFAULT NULL COMMENT '审核状体',
|
||||
process_time datetime DEFAULT NULL COMMENT '审核时间',
|
||||
remark varchar(1024) DEFAULT NULL COMMENT '备注',
|
||||
@@ -59,6 +57,36 @@ CREATE TABLE `sys_user_face`
|
||||
CREATE INDEX idx_dept_id ON sys_user_face (user_id);
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_user_tag
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS sys_user_tag;
|
||||
CREATE TABLE `sys_user_tag`
|
||||
(
|
||||
id bigint NOT NULL COMMENT '编号',
|
||||
user_id bigint NOT NULL COMMENT '用户ID',
|
||||
title varchar(64) NOT NULL COMMENT 'tag名',
|
||||
img varchar(256) DEFAULT NULL COMMENT 'tag图片',
|
||||
biz_type varchar(32) NOT NULL COMMENT '业务类型',
|
||||
expire_time datetime DEFAULT NULL COMMENT 'tag过期时间(null:永久有效)',
|
||||
status varchar(32) NOT NULL COMMENT 'tag状态',
|
||||
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 ='用户tag';
|
||||
-- 为 user_id 添加普通索引
|
||||
CREATE INDEX idx_user_id ON sys_user_tag (user_id);
|
||||
-- 为 biz_type 添加普通索引
|
||||
CREATE INDEX idx_biz_type ON sys_user_tag (biz_type);
|
||||
-- 为 status 添加普通索引
|
||||
CREATE INDEX idx_status ON sys_user_tag (status);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_user_car
|
||||
-- ----------------------------
|
||||
@@ -153,10 +181,10 @@ CREATE TABLE mch_dept
|
||||
id BIGINT(19) not null comment '主键',
|
||||
mch_id BIGINT(19) not null comment '商户id',
|
||||
dept_id BIGINT(19) not null comment '部门id',
|
||||
create_by VARCHAR(64) null comment '创建人',
|
||||
create_time DATETIME null comment '创建时间',
|
||||
update_by VARCHAR(64) null comment '修改人',
|
||||
update_time DATETIME null comment '修改时间',
|
||||
create_by VARCHAR(64) null comment '创建人',
|
||||
create_time DATETIME null comment '创建时间',
|
||||
update_by VARCHAR(64) null comment '修改人',
|
||||
update_time DATETIME null comment '修改时间',
|
||||
del_flag CHAR default '0' null comment '删除标记',
|
||||
tenant_id BIGINT(19) null comment '租户ID',
|
||||
PRIMARY KEY (id)
|
||||
@@ -502,8 +530,8 @@ CREATE TABLE wallet_foreign
|
||||
process_status varchar(10) NOT NULL COMMENT '审核状体',
|
||||
process_time datetime COMMENT '审核时间',
|
||||
dept_id bigint NOT NULL COMMENT '部门id',
|
||||
apply_start_time date NULL COMMENT '申请使用开始时间',
|
||||
apply_end_time date NULL COMMENT '申请使用结束时间',
|
||||
apply_start_time date NULL COMMENT '申请使用开始时间',
|
||||
apply_end_time date NULL COMMENT '申请使用结束时间',
|
||||
count int NOT NULL COMMENT '申请数量',
|
||||
use_count int DEFAULT 0 COMMENT '使用数量',
|
||||
remark VARCHAR(1024) COMMENT '申请备注',
|
||||
@@ -531,7 +559,7 @@ CREATE TABLE wallet_code_use
|
||||
code varchar(1024) DEFAULT NULL COMMENT '二维码',
|
||||
code_content varchar(1024) DEFAULT NULL COMMENT '二维码内容',
|
||||
short_code varchar(32) DEFAULT '' COMMENT '短码',
|
||||
use_time timestamp 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 '修改人',
|
||||
@@ -574,18 +602,18 @@ create table wallet_recharge
|
||||
total_price int NOT NULL COMMENT '用户实际到账余额,例如充 100 送 20,则该值是 120',
|
||||
pay_price int NOT NULL COMMENT '实际支付金额',
|
||||
bonus_price int NOT NULL COMMENT '钱包赠送金额',
|
||||
package_id bigint NULL COMMENT '充值套餐编号',
|
||||
package_id bigint NULL COMMENT '充值套餐编号',
|
||||
pay_status bit default b'0' NOT NULL COMMENT '是否已支付:[0:未支付 1:已经支付过]',
|
||||
pay_order_id bigint NULL COMMENT '支付订单编号',
|
||||
pay_channel_code varchar(16) NULL COMMENT '支付成功的支付渠道',
|
||||
pay_time datetime NULL COMMENT '订单支付时间',
|
||||
pay_refund_order_id bigint NULL COMMENT '退款订单号',
|
||||
pay_refund_after_sale_id bigint NULL COMMENT '售后单号id',
|
||||
pay_refund_code varchar(256) NULL COMMENT '支付退款单code',
|
||||
pay_order_id bigint NULL COMMENT '支付订单编号',
|
||||
pay_channel_code varchar(16) NULL COMMENT '支付成功的支付渠道',
|
||||
pay_time datetime NULL COMMENT '订单支付时间',
|
||||
pay_refund_order_id bigint NULL COMMENT '退款订单号',
|
||||
pay_refund_after_sale_id bigint NULL COMMENT '售后单号id',
|
||||
pay_refund_code varchar(256) NULL COMMENT '支付退款单code',
|
||||
refund_total_price int default 0 NOT NULL COMMENT '退款金额,包含赠送金额',
|
||||
refund_pay_price int default 0 NOT NULL COMMENT '退款支付金额',
|
||||
refund_bonus_price int default 0 NOT NULL COMMENT '退款钱包赠送金额',
|
||||
refund_time datetime NULL COMMENT '退款时间',
|
||||
refund_time datetime NULL COMMENT '退款时间',
|
||||
refund_status char(10) default '0' NOT NULL COMMENT '退款状态',
|
||||
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
|
||||
create_time datetime DEFAULT NULL COMMENT '创建时间',
|
||||
@@ -656,8 +684,8 @@ CREATE TABLE mch_pick_up
|
||||
introduction varchar(256) DEFAULT NULL COMMENT '门店简介',
|
||||
phone varchar(16) DEFAULT NULL COMMENT '门店手机',
|
||||
status varchar(32) DEFAULT NULL COMMENT '门店状态',
|
||||
latitude double DEFAULT NULL COMMENT '纬度',
|
||||
longitude double DEFAULT NULL COMMENT '经度',
|
||||
latitude double DEFAULT NULL COMMENT '纬度',
|
||||
longitude double DEFAULT NULL COMMENT '经度',
|
||||
detail_address varchar(256) DEFAULT NULL COMMENT '门店详细地址',
|
||||
business_hours_json varchar(1024) DEFAULT NULL COMMENT '营业时间',
|
||||
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
|
||||
|
||||
-5
@@ -40,11 +40,6 @@ public class XfjTransactionVo extends XfjBaseVo {
|
||||
*/
|
||||
private String Balance;
|
||||
|
||||
/**
|
||||
* 消费类型(消费 充值 退款,因错退还)
|
||||
*/
|
||||
@JsonProperty("Class")
|
||||
private String classAlias;
|
||||
|
||||
/**
|
||||
* 消费订单号
|
||||
|
||||
+1
-2
@@ -4,7 +4,6 @@ import com.bsd.pjcloud.common.security.annotation.Inner;
|
||||
import com.bsd.pjcloud.hard.api.vo.xfj.XfjCountsVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.xfj.XfjServerTimeVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.xfj.XfjTransactionInquiryVo;
|
||||
import com.bsd.pjcloud.hard.api.vo.xfj.XfjTransactionVo;
|
||||
import com.bsd.pjcloud.hard.service.HardXfjService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
@@ -60,7 +59,7 @@ public class HardXfjController {
|
||||
@Operation(summary = "终端设备待查状态,按上翻/下翻键向服务器请求,服务器返回一条消费明细(或者退款接口)")
|
||||
@PostMapping("/v1/transaction")
|
||||
@Inner(value = false)
|
||||
public XfjTransactionVo transaction(HttpEntity<String> httpEntity, @RequestHeader Map<String, String> headers) {
|
||||
public Object transaction(HttpEntity<String> httpEntity, @RequestHeader Map<String, String> headers) {
|
||||
return hardXfjService.transaction(httpEntity.getBody(), headers);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ public interface HardXfjService {
|
||||
/**
|
||||
* 终端设备待查状态,按上翻/下翻键向服务器请求,服务器返回一条消费明细(或者退款接口)
|
||||
*/
|
||||
XfjTransactionVo transaction(String body, Map<String, String> headers);
|
||||
Object transaction(String body, Map<String, String> headers);
|
||||
|
||||
/**
|
||||
* KeepAlive
|
||||
|
||||
+19
-11
@@ -1,12 +1,15 @@
|
||||
package com.bsd.pjcloud.hard.service.impl.xfj;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.admin.api.dto.UserInfo;
|
||||
import com.bsd.pjcloud.admin.api.feign.RemoteUserService;
|
||||
import com.bsd.pjcloud.common.core.util.BeanUtils;
|
||||
import com.bsd.pjcloud.hard.api.constant.HardTypeEnum;
|
||||
import com.bsd.pjcloud.hard.api.constant.xfj.HardXfjTypeEnum;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardOrderDto;
|
||||
@@ -269,23 +272,20 @@ public class HardXfjServiceImpl implements HardXfjService {
|
||||
* 终端设备待查状态,按上翻/下翻键向服务器请求,服务器返回一条消费明细(或者退款接口)
|
||||
*/
|
||||
@Override
|
||||
public XfjTransactionVo transaction(String body, Map<String, String> headers) {
|
||||
public Object transaction(String body, Map<String, String> headers) {
|
||||
HardXfjLogEntity logger = initLogger(body, headers, "终端设备待查状态,按上翻/下翻键向服务器请求,服务器返回一条消费明细(或者退款接口)");
|
||||
XfjTransactionVo result = new XfjTransactionVo();
|
||||
try {
|
||||
HardManagerEntity hardEntity = checkSignAndReturnConfig(body, headers);
|
||||
logger.setUniqueCode(hardEntity.getUniqueCode());
|
||||
// 获取参数
|
||||
XfjTransactionDto dto = JSONUtil.toBean(body, XfjTransactionDto.class);
|
||||
if (ObjectUtil.isEmpty(dto)) {
|
||||
throw new RuntimeException("解析参数为空");
|
||||
}
|
||||
XfjTransactionDto pageDto = JSONUtil.toBean(body, XfjTransactionDto.class);
|
||||
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
|
||||
// 上翻/下翻
|
||||
if (true) {
|
||||
long current = dto.getNumber();
|
||||
if (ObjectUtil.isNotEmpty(pageDto) && ObjectUtil.isNotEmpty(pageDto.getNumber())) {
|
||||
long current = pageDto.getNumber();
|
||||
long pageSize = 1;
|
||||
HardOrderDto orderDto = new HardOrderDto();
|
||||
orderDto.setHardId(hardEntity.getId());
|
||||
@@ -319,15 +319,17 @@ public class HardXfjServiceImpl implements HardXfjService {
|
||||
if (ObjectUtil.isNotEmpty(wallet) && ObjectUtil.isNotEmpty(wallet.getBalance())) {
|
||||
balance = wallet.getBalance();
|
||||
}
|
||||
result.setNumber(String.valueOf(dto.getNumber()));
|
||||
result.setNumber(String.valueOf(pageDto.getNumber()));
|
||||
result.setTime(LocalDateTimeUtil.format(order.getPayTime(), DatePattern.PURE_DATETIME_PATTERN));
|
||||
result.setCardNo("");
|
||||
result.setName(username);
|
||||
result.setConsume(fenToYuan(BigDecimal.valueOf(order.getPayPrice())));
|
||||
result.setBalance(fenToYuan(BigDecimal.valueOf(balance)));
|
||||
result.setClassAlias("消费");
|
||||
result.setOrderSeralid(String.valueOf(order.getId()));
|
||||
return result;
|
||||
|
||||
Map<String, Object> resultMap = BeanUtil.beanToMap(result);
|
||||
resultMap.put("Class", "消费");
|
||||
return resultMap;
|
||||
}
|
||||
// 退款
|
||||
else if (false) {
|
||||
@@ -380,18 +382,24 @@ public class HardXfjServiceImpl implements HardXfjService {
|
||||
payDto.setXfjPayType(HardXfjTypeEnum.QRCODE_PAY);
|
||||
Long orderId = hardOrderService.xfjFastCreateOrder(payDto);
|
||||
result.setQrorder(String.valueOf(orderId));
|
||||
return result;
|
||||
}
|
||||
// 充值
|
||||
else if (ObjectUtil.equals(dto.getMode(), "1")) {
|
||||
result.setStatus(XfjBaseVo.STATUS_FAIL);
|
||||
result.setMsg("不支持充值");
|
||||
return result;
|
||||
}
|
||||
// 信息查询
|
||||
else if (ObjectUtil.equals(dto.getMode(), "3")) {
|
||||
result.setStatus(XfjBaseVo.STATUS_FAIL);
|
||||
result.setMsg("不支持信息查询");
|
||||
return result;
|
||||
} else {
|
||||
result.setStatus(XfjBaseVo.STATUS_FAIL);
|
||||
result.setMsg("不支持的操作");
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
logger.setError(e.getMessage());
|
||||
e.printStackTrace();
|
||||
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package com.bsd.pjcloud.admin.api.constant.user;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.bsd.pjcloud.admin.api.constant.UserTransactionEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 用户标签状态
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum UserTagStatusEnum {
|
||||
WEARING("10", "已佩戴"),
|
||||
EXPIRED("20", "已过期"),
|
||||
RECLAIMED("30", "已回收"),
|
||||
;
|
||||
private final String type;
|
||||
private final String description;
|
||||
|
||||
public static UserTagStatusEnum valueOfByType(String type) {
|
||||
if (ObjectUtil.isEmpty(type)) return null;
|
||||
return Arrays.stream(values()).filter(v -> ObjectUtil.equals(type, v.getType())).findFirst().orElse(null);
|
||||
}
|
||||
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package com.bsd.pjcloud.admin.api.constant.user;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 用户标签类型
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum UserTagTypeEnum {
|
||||
VIP("10", "vip"),
|
||||
;
|
||||
private final String type;
|
||||
private final String description;
|
||||
|
||||
public static UserTagTypeEnum valueOfByType(String type) {
|
||||
if (ObjectUtil.isEmpty(type)) return null;
|
||||
return Arrays.stream(values()).filter(v -> ObjectUtil.equals(type, v.getType())).findFirst().orElse(null);
|
||||
}
|
||||
|
||||
}
|
||||
+28
-20
@@ -20,10 +20,13 @@
|
||||
package com.bsd.pjcloud.admin.api.dto;
|
||||
|
||||
import com.bsd.pjcloud.admin.api.entity.SysUser;
|
||||
import com.bsd.pjcloud.admin.api.entity.user.SysUserTagEntity;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jdk.dynalink.linker.LinkerServices;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author pjcloud
|
||||
@@ -33,28 +36,33 @@ import java.io.Serializable;
|
||||
@Schema(description = "用户信息")
|
||||
public class UserInfo implements Serializable {
|
||||
|
||||
/**
|
||||
* 用户基本信息
|
||||
*/
|
||||
@Schema(description = "用户基本信息")
|
||||
private SysUser sysUser;
|
||||
/**
|
||||
* 用户基本信息
|
||||
*/
|
||||
@Schema(description = "用户基本信息")
|
||||
private SysUser sysUser;
|
||||
|
||||
/**
|
||||
* 权限标识集合
|
||||
*/
|
||||
@Schema(description = "权限标识集合")
|
||||
private String[] permissions;
|
||||
/**
|
||||
* 用户tags
|
||||
*/
|
||||
@Schema(description = "用户tags")
|
||||
private List<SysUserTagEntity> userTags;
|
||||
|
||||
/**
|
||||
* 角色集合
|
||||
*/
|
||||
@Schema(description = "角色标识集合")
|
||||
private Long[] roles;
|
||||
/**
|
||||
* 权限标识集合
|
||||
*/
|
||||
@Schema(description = "权限标识集合")
|
||||
private String[] permissions;
|
||||
|
||||
/**
|
||||
* 角色集合
|
||||
*/
|
||||
@Schema(description = "角色标识集合")
|
||||
private String[] roleCodes;
|
||||
/**
|
||||
* 角色集合
|
||||
*/
|
||||
@Schema(description = "角色标识集合")
|
||||
private Long[] roles;
|
||||
|
||||
/**
|
||||
* 角色集合
|
||||
*/
|
||||
@Schema(description = "角色标识集合")
|
||||
private String[] roleCodes;
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package com.bsd.pjcloud.admin.api.dto.user;
|
||||
|
||||
import com.bsd.pjcloud.admin.api.entity.user.SysUserTagEntity;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SysUserTagDto extends SysUserTagEntity {
|
||||
|
||||
}
|
||||
+3
@@ -21,6 +21,8 @@ package com.bsd.pjcloud.admin.api.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import com.bsd.pjcloud.admin.api.entity.user.SysUserTagEntity;
|
||||
import com.bsd.pjcloud.admin.api.vo.user.SysUserTagVo;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.bsd.pjcloud.common.core.util.TenantTable;
|
||||
|
||||
@@ -32,6 +34,7 @@ import org.javers.core.metamodel.annotation.PropertyName;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
package com.bsd.pjcloud.admin.api.entity.user;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* 用户tag
|
||||
*/
|
||||
@Data
|
||||
@TenantTable
|
||||
@TableName("sys_user_tag")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(description = "用户tag")
|
||||
public class SysUserTagEntity extends Model<SysUserTagEntity> {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description = "编号")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
@Schema(description = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* tag名
|
||||
*/
|
||||
@Schema(description = "tag名")
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* tag图片
|
||||
*/
|
||||
@Schema(description = "tag图片")
|
||||
private String img;
|
||||
|
||||
/**
|
||||
* 业务类型
|
||||
*/
|
||||
@Schema(description = "业务类型")
|
||||
private String bizType;
|
||||
|
||||
/**
|
||||
* tag过期时间(null:永久有效)
|
||||
*/
|
||||
@Schema(description = "tag过期时间(null:永久有效)")
|
||||
private LocalDateTime expireTime;
|
||||
|
||||
/**
|
||||
* tag状态
|
||||
*/
|
||||
@Schema(description = "tag状态")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@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;
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package com.bsd.pjcloud.admin.api.vo.user;
|
||||
|
||||
import com.bsd.pjcloud.admin.api.entity.user.SysUserTagEntity;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SysUserTagVo extends SysUserTagEntity {
|
||||
}
|
||||
+2
-5
@@ -32,11 +32,9 @@ import com.bsd.pjcloud.admin.api.entity.SysDept;
|
||||
import com.bsd.pjcloud.admin.api.entity.SysRole;
|
||||
import com.bsd.pjcloud.admin.api.entity.SysUser;
|
||||
import com.bsd.pjcloud.admin.api.entity.SysUserRole;
|
||||
import com.bsd.pjcloud.admin.api.entity.user.SysUserTagEntity;
|
||||
import com.bsd.pjcloud.admin.api.vo.*;
|
||||
import com.bsd.pjcloud.admin.service.SysDeptService;
|
||||
import com.bsd.pjcloud.admin.service.SysRoleService;
|
||||
import com.bsd.pjcloud.admin.service.SysUserRoleService;
|
||||
import com.bsd.pjcloud.admin.service.SysUserService;
|
||||
import com.bsd.pjcloud.admin.service.*;
|
||||
import com.bsd.pjcloud.common.core.constant.CommonConstants;
|
||||
import com.bsd.pjcloud.common.core.exception.ErrorCodes;
|
||||
import com.bsd.pjcloud.common.core.util.MsgUtils;
|
||||
@@ -208,7 +206,6 @@ public class SysUserController {
|
||||
if (user == null) {
|
||||
return R.failed(MsgUtils.getMessage(ErrorCodes.SYS_USER_QUERY_ERROR));
|
||||
}
|
||||
|
||||
// UserInfo 是复用对象,不能通过设置 @jsonIgnore 来忽略密码字段
|
||||
UserInfo userInfo = userService.findUserInfo(user);
|
||||
userInfo.getSysUser().setPassword(null);
|
||||
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
package com.bsd.pjcloud.admin.controller.user;
|
||||
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
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.admin.api.dto.user.SysUserTagDto;
|
||||
import com.bsd.pjcloud.admin.api.entity.user.SysUserTagEntity;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.admin.service.SysUserTagService;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 用户tag
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/sys-user-tag")
|
||||
@Tag(description = "sysUserTag", name = "用户tag管理")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class SysUserTagController {
|
||||
|
||||
private final SysUserTagService sysUserTagService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page")
|
||||
@PreAuthorize("@pms.hasPermission('admin_sysUserTag_view')")
|
||||
public R getSysUserTagPage(@ParameterObject Page page, @ParameterObject SysUserTagDto dto) {
|
||||
LambdaQueryWrapper<SysUserTagEntity> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.eq(ObjectUtil.isNotEmpty(dto.getUserId()), SysUserTagEntity::getUserId, dto.getUserId());
|
||||
return R.ok(sysUserTagService.page(page, wrapper));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询用户tag
|
||||
*/
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@GetMapping("/{id}")
|
||||
@PreAuthorize("@pms.hasPermission('admin_sysUserTag_view')")
|
||||
public R getById(@PathVariable("id") Long id) {
|
||||
return R.ok(sysUserTagService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户tag
|
||||
*/
|
||||
@Operation(summary = "新增用户tag", description = "新增用户tag")
|
||||
@SysLog("新增用户tag")
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('admin_sysUserTag_add')")
|
||||
public R<Long> save(@RequestBody SysUserTagDto dto) {
|
||||
return R.ok(sysUserTagService.create(dto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户tag
|
||||
*/
|
||||
@Operation(summary = "修改用户tag", description = "修改用户tag")
|
||||
@SysLog("修改用户tag")
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('admin_sysUserTag_edit')")
|
||||
public R updateById(@RequestBody SysUserTagEntity sysUserTag) {
|
||||
return R.ok(sysUserTagService.updateById(sysUserTag));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除用户tag
|
||||
*/
|
||||
@Operation(summary = "通过id删除用户tag", description = "通过id删除用户tag")
|
||||
@SysLog("通过id删除用户tag")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@pms.hasPermission('admin_sysUserTag_del')")
|
||||
public R removeById(@RequestBody Long[] ids) {
|
||||
return R.ok(sysUserTagService.removeBatchByIds(CollUtil.toList(ids)));
|
||||
}
|
||||
}
|
||||
Executable
+10
@@ -0,0 +1,10 @@
|
||||
package com.bsd.pjcloud.admin.mapper.user;
|
||||
|
||||
import com.bsd.pjcloud.admin.api.entity.user.SysUserTagEntity;
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface SysUserTagMapper extends PjcloudBaseMapper<SysUserTagEntity> {
|
||||
|
||||
}
|
||||
Executable
+14
@@ -0,0 +1,14 @@
|
||||
package com.bsd.pjcloud.admin.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.admin.api.dto.user.SysUserTagDto;
|
||||
import com.bsd.pjcloud.admin.api.entity.user.SysUserTagEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SysUserTagService extends IService<SysUserTagEntity> {
|
||||
|
||||
Long create(SysUserTagDto dto);
|
||||
|
||||
List<SysUserTagEntity> getByUserId(Long userId);
|
||||
}
|
||||
+6
@@ -39,6 +39,7 @@ import com.bsd.pjcloud.admin.api.dto.SysUserFaceDto;
|
||||
import com.bsd.pjcloud.admin.api.dto.UserDTO;
|
||||
import com.bsd.pjcloud.admin.api.dto.UserInfo;
|
||||
import com.bsd.pjcloud.admin.api.entity.*;
|
||||
import com.bsd.pjcloud.admin.api.entity.user.SysUserTagEntity;
|
||||
import com.bsd.pjcloud.admin.api.utils.DataUtil;
|
||||
import com.bsd.pjcloud.admin.api.vo.*;
|
||||
import com.bsd.pjcloud.admin.mapper.SysUserFaceMapper;
|
||||
@@ -115,6 +116,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
|
||||
private final SysDeptService sysDeptService;
|
||||
|
||||
private final SysUserTagService sysUserTagService;
|
||||
|
||||
@Lazy
|
||||
private final SysUserFaceService sysUserFaceService;
|
||||
private final SysUserFaceMapper sysUserFaceMapper;
|
||||
@@ -253,6 +256,9 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
permissions.addAll(permissionList);
|
||||
});
|
||||
userInfo.setPermissions(ArrayUtil.toArray(permissions, String.class));
|
||||
|
||||
List<SysUserTagEntity> tagList = sysUserTagService.getByUserId(sysUser.getUserId());
|
||||
userInfo.setUserTags(tagList);
|
||||
return userInfo;
|
||||
}
|
||||
|
||||
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
package com.bsd.pjcloud.admin.service.impl.user;
|
||||
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.admin.api.constant.user.UserTagStatusEnum;
|
||||
import com.bsd.pjcloud.admin.api.dto.user.SysUserTagDto;
|
||||
import com.bsd.pjcloud.admin.api.entity.user.SysUserTagEntity;
|
||||
import com.bsd.pjcloud.admin.mapper.user.SysUserTagMapper;
|
||||
import com.bsd.pjcloud.admin.service.SysUserTagService;
|
||||
import com.bsd.pjcloud.common.core.util.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户tag
|
||||
*/
|
||||
@Service
|
||||
public class SysUserTagServiceImpl extends ServiceImpl<SysUserTagMapper, SysUserTagEntity> implements SysUserTagService {
|
||||
|
||||
@Override
|
||||
public Long create(SysUserTagDto dto) {
|
||||
SysUserTagEntity saveObj = BeanUtils.toBean(dto, SysUserTagEntity.class);
|
||||
if (ObjectUtil.isEmpty(saveObj.getStatus())) {
|
||||
saveObj.setStatus(UserTagStatusEnum.WEARING.getType());
|
||||
}
|
||||
baseMapper.insert(saveObj);
|
||||
return saveObj.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysUserTagEntity> getByUserId(Long userId) {
|
||||
List<SysUserTagEntity> list = baseMapper.selectList(new LambdaQueryWrapper<SysUserTagEntity>()
|
||||
.eq(SysUserTagEntity::getUserId, userId)
|
||||
.eq(SysUserTagEntity::getStatus, UserTagStatusEnum.WEARING.getType())
|
||||
.and(wrapper ->
|
||||
wrapper.isNull(SysUserTagEntity::getExpireTime)
|
||||
.or()
|
||||
.ge(SysUserTagEntity::getExpireTime, LocalDateTimeUtil.format(LocalDateTime.now(), DatePattern.NORM_DATETIME_PATTERN))
|
||||
)
|
||||
);
|
||||
if (ObjectUtil.isEmpty(list)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user