feat:多钱包、电子饭卡、饭卡充值
This commit is contained in:
1 parent
d684f1bc97
commit
0f6da3a679
40 files changed
+1781
-225
No files matched your search
+27
-18
@@ -9,8 +9,8 @@ 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',
|
||||
card_number varchar(64) COMMENT '饭卡卡号',
|
||||
code varchar(1024) COMMENT '钱包二维码',
|
||||
balance int DEFAULT 0 NOT NULL COMMENT '余额,单位分',
|
||||
total_expense int DEFAULT 0 NOT NULL COMMENT '累计支出,单位分',
|
||||
total_recharge int DEFAULT 0 NOT NULL COMMENT '累计充值,单位分',
|
||||
@@ -27,11 +27,11 @@ CREATE TABLE wallet_manage
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4
|
||||
COLLATE = utf8mb4_general_ci COMMENT ='商户管理';
|
||||
COLLATE = utf8mb4_general_ci COMMENT ='钱包管理';
|
||||
CREATE INDEX idx_dept_id ON wallet_manage (user_id);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for wallet_manage
|
||||
-- Table structure for wallet_type
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS wallet_type;
|
||||
CREATE TABLE wallet_type
|
||||
@@ -54,16 +54,23 @@ CREATE TABLE wallet_type
|
||||
-- ----------------------------
|
||||
-- Table structure for wallet_active
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS wallet_active;
|
||||
CREATE TABLE wallet_active
|
||||
(
|
||||
id bigint NOT NULL COMMENT '主键',
|
||||
user_id bigint NOT NULL COMMENT '用户编号',
|
||||
wallet_id bigint NOT NULL COMMENT '钱包编号',
|
||||
wallet_type_id bigint NOT NULL COMMENT '饭卡类型',
|
||||
dept_id BIGINT NOT NULL COMMENT '部门id',
|
||||
merchant_id BIGINT NOT NULL COMMENT '商户id',
|
||||
card_number varchar(128) NOT NULL COMMENT '用户卡号',
|
||||
active_hardware_status TINYINT DEFAULT 0 COMMENT '是否在硬件上激活',
|
||||
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',
|
||||
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 '饭卡是否在硬件上激活',
|
||||
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 ='钱包开卡';
|
||||
@@ -74,22 +81,24 @@ CREATE INDEX idx_dept_id ON wallet_active (wallet_type_id);
|
||||
-- ----------------------------
|
||||
-- Table structure for wallet_freeze
|
||||
-- ----------------------------
|
||||
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',
|
||||
flow_id bigint DEFAULT NULL COMMENT '流程id',
|
||||
username varchar(128) COMMENT '用户名',
|
||||
status TINYINT NOT NULL COMMENT '审核状态',
|
||||
remark varchar(1024) COMMENT '备注',
|
||||
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 '冻结状态',
|
||||
remark varchar(1024) COMMENT '备注',
|
||||
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
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS wallet_transaction;
|
||||
CREATE TABLE wallet_transaction
|
||||
(
|
||||
id bigint NOT NULL COMMENT '编号',
|
||||
|
||||
+7
@@ -120,4 +120,11 @@ public interface CacheConstants {
|
||||
*/
|
||||
String PROJECT_OAUTH_ACCESS = "token::access_token";
|
||||
|
||||
/* ************************************* start 钱包相关 start ************************************* */
|
||||
|
||||
String WALLET_DETAIL = "wallet:detail:manage";
|
||||
|
||||
String WALLET_TYPE_DETAIL = "wallet:detail:type";
|
||||
|
||||
/* ************************************* end 钱包相关 end ************************************* */
|
||||
}
|
||||
+4
-1
@@ -67,5 +67,8 @@ public interface ServiceNameConstants {
|
||||
*/
|
||||
String CANTEEN_SERVICE = "pjcloud-canteen-biz";
|
||||
|
||||
|
||||
/**
|
||||
* 钱包模块
|
||||
*/
|
||||
String WALLET_SERVICE = "pjcloud-wallet-biz";
|
||||
}
|
||||
+6
@@ -51,4 +51,10 @@ public class UserInfo implements Serializable {
|
||||
@Schema(description = "角色标识集合")
|
||||
private Long[] roles;
|
||||
|
||||
/**
|
||||
* 角色集合
|
||||
*/
|
||||
@Schema(description = "角色标识集合")
|
||||
private String[] roleCodes;
|
||||
|
||||
}
|
||||
+99
-80
@@ -37,94 +37,113 @@ import java.util.List;
|
||||
@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.UPMS_SERVICE)
|
||||
public interface RemoteUserService {
|
||||
|
||||
/**
|
||||
* 通过用户名查询用户、角色信息
|
||||
* @param username 用户名
|
||||
* @return R
|
||||
*/
|
||||
@NoToken
|
||||
@GetMapping("/user/info/{username}")
|
||||
R<UserInfo> info(@PathVariable("username") String username);
|
||||
/**
|
||||
* 通过用户名查询用户、角色信息
|
||||
*
|
||||
* @param username 用户名
|
||||
* @return R
|
||||
*/
|
||||
@NoToken
|
||||
@GetMapping("/user/info/{username}")
|
||||
R<UserInfo> info(@PathVariable("username") String username);
|
||||
|
||||
/**
|
||||
* 根据用户ID获取用户
|
||||
* @param userIds ID
|
||||
* @return SysUser
|
||||
*/
|
||||
@GetMapping("/user/list")
|
||||
R<List<SysUser>> getUserById(@RequestParam("userIds") List<Long> userIds);
|
||||
/**
|
||||
* 通过用户id查询用户、角色信息
|
||||
*
|
||||
* @param userId 用户名
|
||||
* @return R
|
||||
*/
|
||||
@NoToken
|
||||
@GetMapping("/user/get-by-user-id")
|
||||
R<UserInfo> getByUserId(@RequestParam("userId") Long userId);
|
||||
|
||||
/**
|
||||
* 通过社交账号或手机号查询用户、角色信息
|
||||
* @param inStr appid@code
|
||||
* @return
|
||||
*/
|
||||
@NoToken
|
||||
@GetMapping("/social/info/{inStr}")
|
||||
R<UserInfo> social(@PathVariable("inStr") String inStr);
|
||||
/**
|
||||
* 根据用户ID获取用户
|
||||
*
|
||||
* @param userIds ID
|
||||
* @return SysUser
|
||||
*/
|
||||
@GetMapping("/user/list")
|
||||
R<List<SysUser>> getUserById(@RequestParam("userIds") List<Long> userIds);
|
||||
|
||||
/**
|
||||
* 查询上级部门的用户信息
|
||||
* @param username 用户名
|
||||
* @return R
|
||||
*/
|
||||
@GetMapping("/user/ancestor/{username}")
|
||||
R<List<SysUser>> ancestorUsers(@PathVariable("username") String username);
|
||||
/**
|
||||
* 通过社交账号或手机号查询用户、角色信息
|
||||
*
|
||||
* @param inStr appid@code
|
||||
* @return
|
||||
*/
|
||||
@NoToken
|
||||
@GetMapping("/social/info/{inStr}")
|
||||
R<UserInfo> social(@PathVariable("inStr") String inStr);
|
||||
|
||||
/**
|
||||
* 锁定用户
|
||||
* @param username 用户名
|
||||
* @return
|
||||
*/
|
||||
@NoToken
|
||||
@PutMapping("/user/lock/{username}")
|
||||
R<Boolean> lockUser(@PathVariable("username") String username);
|
||||
/**
|
||||
* 查询上级部门的用户信息
|
||||
*
|
||||
* @param username 用户名
|
||||
* @return R
|
||||
*/
|
||||
@GetMapping("/user/ancestor/{username}")
|
||||
R<List<SysUser>> ancestorUsers(@PathVariable("username") String username);
|
||||
|
||||
/**
|
||||
* 根据角色ID查询用户列表
|
||||
* @param roleIdList 角色ID列表
|
||||
* @return 用户ID列表
|
||||
*/
|
||||
@GetMapping("/user/getUserIdListByRoleIdList")
|
||||
R<List<Long>> getUserIdListByRoleIdList(@RequestParam("roleIdList") List<Long> roleIdList);
|
||||
/**
|
||||
* 锁定用户
|
||||
*
|
||||
* @param username 用户名
|
||||
* @return
|
||||
*/
|
||||
@NoToken
|
||||
@PutMapping("/user/lock/{username}")
|
||||
R<Boolean> lockUser(@PathVariable("username") String username);
|
||||
|
||||
/**
|
||||
* 根据部门ID列表获取用户ID列表接口
|
||||
* @param deptIdList 部门ID列表
|
||||
* @return 用户ID列表
|
||||
*/
|
||||
@GetMapping("/user/getUserIdListByDeptIdList")
|
||||
R<List<SysUser>> getUserIdListByDeptIdList(@RequestParam("deptIdList") List<Long> deptIdList);
|
||||
/**
|
||||
* 根据角色ID查询用户列表
|
||||
*
|
||||
* @param roleIdList 角色ID列表
|
||||
* @return 用户ID列表
|
||||
*/
|
||||
@GetMapping("/user/getUserIdListByRoleIdList")
|
||||
R<List<Long>> getUserIdListByRoleIdList(@RequestParam("roleIdList") List<Long> roleIdList);
|
||||
|
||||
/**
|
||||
* 通过用户名查询用户列表
|
||||
* @param userName 用户名
|
||||
* @return 用户列表
|
||||
*/
|
||||
@GetMapping("/user/getUserListByUserName")
|
||||
R<List<SysUser>> getUserListByUserName(@RequestParam("username") String userName);
|
||||
/**
|
||||
* 根据部门ID列表获取用户ID列表接口
|
||||
*
|
||||
* @param deptIdList 部门ID列表
|
||||
* @return 用户ID列表
|
||||
*/
|
||||
@GetMapping("/user/getUserIdListByDeptIdList")
|
||||
R<List<SysUser>> getUserIdListByDeptIdList(@RequestParam("deptIdList") List<Long> deptIdList);
|
||||
|
||||
/**
|
||||
* 注册用户
|
||||
* @param userDTO 用户信息
|
||||
* @return success/false
|
||||
*/
|
||||
@NoToken
|
||||
@PostMapping("/register/user")
|
||||
R<Boolean> registerUser(@RequestBody UserDTO userDTO);
|
||||
/**
|
||||
* 通过用户名查询用户列表
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @return 用户列表
|
||||
*/
|
||||
@GetMapping("/user/getUserListByUserName")
|
||||
R<List<SysUser>> getUserListByUserName(@RequestParam("username") String userName);
|
||||
|
||||
/**
|
||||
* 根据钉钉号和手机号查询用户信息
|
||||
* @param employeeCode 钉钉号
|
||||
*
|
||||
* @return 用户信息
|
||||
*/
|
||||
@NoToken
|
||||
@GetMapping("/user/getUserByMobileOrEmployeeCode")
|
||||
R<List<SysUser>> getUserByMobileOrEmployeeCode(@RequestParam("employeeCode")String employeeCode,
|
||||
@RequestParam("mobile") String mobile);
|
||||
/**
|
||||
* 注册用户
|
||||
*
|
||||
* @param userDTO 用户信息
|
||||
* @return success/false
|
||||
*/
|
||||
@NoToken
|
||||
@PostMapping("/register/user")
|
||||
R<Boolean> registerUser(@RequestBody UserDTO userDTO);
|
||||
|
||||
@NoToken
|
||||
@GetMapping("/user/getUserByMobile")
|
||||
R<List<SysUser>> getUserByMobile(@RequestParam("mobile") String mobile);
|
||||
/**
|
||||
* 根据钉钉号和手机号查询用户信息
|
||||
*
|
||||
* @param employeeCode 钉钉号
|
||||
* @return 用户信息
|
||||
*/
|
||||
@NoToken
|
||||
@GetMapping("/user/getUserByMobileOrEmployeeCode")
|
||||
R<List<SysUser>> getUserByMobileOrEmployeeCode(@RequestParam("employeeCode") String employeeCode,
|
||||
@RequestParam("mobile") String mobile);
|
||||
|
||||
@NoToken
|
||||
@GetMapping("/user/getUserByMobile")
|
||||
R<List<SysUser>> getUserByMobile(@RequestParam("mobile") String mobile);
|
||||
}
|
||||
+88
-59
@@ -3,84 +3,113 @@ package com.bsd.pjcloud.admin.api.utils;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.bsd.pjcloud.admin.api.entity.SysDept;
|
||||
import com.bsd.pjcloud.admin.api.entity.SysMenu;
|
||||
import com.bsd.pjcloud.admin.api.entity.SysUser;
|
||||
import com.bsd.pjcloud.admin.api.vo.base.BaseDeptInterface;
|
||||
import com.bsd.pjcloud.admin.api.vo.base.BaseUserInterface;
|
||||
import com.bsd.pjcloud.common.core.util.CollectionUtils;
|
||||
import lombok.experimental.UtilityClass;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@UtilityClass
|
||||
public class DataUtil {
|
||||
|
||||
/**
|
||||
* 根据当前部门id,向上查找所有的部门
|
||||
* @param deptId 当前部门id
|
||||
* @param allDeptList 所有部门列表
|
||||
* @return 返回包括自己部门在内的所有父级部门
|
||||
*/
|
||||
public List<SysDept> selectParentByDept(long deptId, List<SysDept> allDeptList) {
|
||||
List<SysDept> list = new ArrayList<>();
|
||||
Optional<SysDept> optionalDept = allDeptList.stream().filter(w -> w.getDeptId() == deptId).findFirst();
|
||||
/**
|
||||
* 根据当前部门id,向上查找所有的部门
|
||||
*
|
||||
* @param deptId 当前部门id
|
||||
* @param allDeptList 所有部门列表
|
||||
* @return 返回包括自己部门在内的所有父级部门
|
||||
*/
|
||||
public List<SysDept> selectParentByDept(long deptId, List<SysDept> allDeptList) {
|
||||
List<SysDept> list = new ArrayList<>();
|
||||
Optional<SysDept> optionalDept = allDeptList.stream().filter(w -> w.getDeptId() == deptId).findFirst();
|
||||
|
||||
optionalDept.ifPresent(dept -> {
|
||||
if (dept.getParentId() != null) {
|
||||
Long parentId = dept.getParentId();
|
||||
List<SysDept> depts = selectParentByDept(parentId, allDeptList);
|
||||
list.add(dept);
|
||||
list.addAll(depts);
|
||||
}
|
||||
});
|
||||
optionalDept.ifPresent(dept -> {
|
||||
if (dept.getParentId() != null) {
|
||||
Long parentId = dept.getParentId();
|
||||
List<SysDept> depts = selectParentByDept(parentId, allDeptList);
|
||||
list.add(dept);
|
||||
list.addAll(depts);
|
||||
}
|
||||
});
|
||||
|
||||
return list;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据当前部门id,向下查找所有的部门
|
||||
* @param deptId 当前部门id
|
||||
* @param allDeptList 所有部门列表
|
||||
* @return 返回包括自己部门在内的所有子级部门
|
||||
*/
|
||||
public List<SysDept> selectChildrenByDept(long deptId, List<SysDept> allDeptList) {
|
||||
List<SysDept> list = new ArrayList<>();
|
||||
Optional<SysDept> optionalDept = allDeptList.stream().filter(w -> w.getDeptId() == deptId).findFirst();
|
||||
/**
|
||||
* 根据当前部门id,向下查找所有的部门
|
||||
*
|
||||
* @param deptId 当前部门id
|
||||
* @param allDeptList 所有部门列表
|
||||
* @return 返回包括自己部门在内的所有子级部门
|
||||
*/
|
||||
public List<SysDept> selectChildrenByDept(long deptId, List<SysDept> allDeptList) {
|
||||
List<SysDept> list = new ArrayList<>();
|
||||
Optional<SysDept> optionalDept = allDeptList.stream().filter(w -> w.getDeptId() == deptId).findFirst();
|
||||
|
||||
optionalDept.ifPresent(list::add);
|
||||
optionalDept.ifPresent(list::add);
|
||||
|
||||
List<SysDept> collect = allDeptList.stream()
|
||||
.filter(w -> w.getParentId() == deptId)
|
||||
.collect(Collectors.toList());
|
||||
List<SysDept> collect = allDeptList.stream()
|
||||
.filter(w -> w.getParentId() == deptId)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (CollUtil.isEmpty(collect)) {
|
||||
return list;
|
||||
}
|
||||
if (CollUtil.isEmpty(collect)) {
|
||||
return list;
|
||||
}
|
||||
|
||||
collect.forEach(dept -> {
|
||||
List<SysDept> depts = selectChildrenByDept(dept.getDeptId(), allDeptList);
|
||||
list.addAll(depts);
|
||||
});
|
||||
collect.forEach(dept -> {
|
||||
List<SysDept> depts = selectChildrenByDept(dept.getDeptId(), allDeptList);
|
||||
list.addAll(depts);
|
||||
});
|
||||
|
||||
return list;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据当前菜单id,向下查找所有的菜单
|
||||
* @param menuId 当前菜单id
|
||||
* @param allMenuList 所有菜单列表
|
||||
* @return 返回包括自己在内的所有子级菜单
|
||||
*/
|
||||
public List<SysMenu> selectChildrenByMenu(long menuId, List<SysMenu> allMenuList) {
|
||||
List<SysMenu> list = new ArrayList<>();
|
||||
list.add(allMenuList.stream().filter(w -> w.getMenuId() == menuId).findFirst().get());
|
||||
/**
|
||||
* 根据当前菜单id,向下查找所有的菜单
|
||||
*
|
||||
* @param menuId 当前菜单id
|
||||
* @param allMenuList 所有菜单列表
|
||||
* @return 返回包括自己在内的所有子级菜单
|
||||
*/
|
||||
public List<SysMenu> selectChildrenByMenu(long menuId, List<SysMenu> allMenuList) {
|
||||
List<SysMenu> list = new ArrayList<>();
|
||||
list.add(allMenuList.stream().filter(w -> w.getMenuId() == menuId).findFirst().get());
|
||||
|
||||
List<SysMenu> collect = allMenuList.stream()
|
||||
.filter(w -> w.getParentId() == menuId)
|
||||
.collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(collect)) {
|
||||
return list;
|
||||
}
|
||||
collect.forEach(dept -> list.addAll(selectChildrenByMenu(dept.getMenuId(), allMenuList)));
|
||||
return list;
|
||||
}
|
||||
List<SysMenu> collect = allMenuList.stream()
|
||||
.filter(w -> w.getParentId() == menuId)
|
||||
.collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(collect)) {
|
||||
return list;
|
||||
}
|
||||
collect.forEach(dept -> list.addAll(selectChildrenByMenu(dept.getMenuId(), allMenuList)));
|
||||
return list;
|
||||
}
|
||||
|
||||
public <T extends BaseUserInterface> List<T> convertUserList(List<T> list, Map<Long, SysUser> map) {
|
||||
return CollectionUtils.convertList(list, user -> convertUser(user, map.get(user.getUserId())));
|
||||
}
|
||||
|
||||
public <T extends BaseUserInterface> T convertUser(T v, SysUser user) {
|
||||
v.setUsername(user.getUsername());
|
||||
v.setUserMobile(user.getPhone());
|
||||
v.setUserAvatar(user.getAvatar());
|
||||
return v;
|
||||
}
|
||||
|
||||
public <T extends BaseDeptInterface> List<T> convertDeptList(List<T> list, Map<Long, SysDept> map) {
|
||||
return CollectionUtils.convertList(list, user -> convertDept(user, map.get(user.getDeptId())));
|
||||
}
|
||||
|
||||
public <T extends BaseDeptInterface> T convertDept(T v, SysDept dept) {
|
||||
v.setDeptId(dept.getDeptId());
|
||||
v.setDeptName(dept.getName());
|
||||
return v;
|
||||
}
|
||||
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.bsd.pjcloud.admin.api.vo.base;
|
||||
|
||||
public interface BaseDeptInterface {
|
||||
|
||||
/**
|
||||
* 部门id
|
||||
*/
|
||||
Long getDeptId();
|
||||
|
||||
void setDeptId(Long deptId);
|
||||
|
||||
/**
|
||||
* 部门名
|
||||
*/
|
||||
String getDeptName();
|
||||
|
||||
void setDeptName(String deptName);
|
||||
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package com.bsd.pjcloud.admin.api.vo.base;
|
||||
|
||||
|
||||
public interface BaseUserInterface {
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
Long getUserId();
|
||||
|
||||
void setUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
String getUsername();
|
||||
|
||||
void setUsername(String username);
|
||||
|
||||
/**
|
||||
* 用户手机号
|
||||
*/
|
||||
String getUserMobile();
|
||||
|
||||
void setUserMobile(String userMobile);
|
||||
|
||||
/**
|
||||
* 用户头像
|
||||
*/
|
||||
String getUserAvatar();
|
||||
|
||||
void setUserAvatar(String userAvatar);
|
||||
|
||||
}
|
||||
@@ -189,6 +189,12 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-undertow</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-wallet-api</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
+16
@@ -78,6 +78,21 @@ public class SysUserController {
|
||||
return R.ok(userService.findUserInfo(user));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定用户全部信息
|
||||
*
|
||||
* @return 用户信息
|
||||
*/
|
||||
@Inner
|
||||
@GetMapping("/get-by-user-id")
|
||||
public R getByUserId(@RequestParam Long userId) {
|
||||
SysUser user = userService.getOne(Wrappers.<SysUser>query().lambda().eq(SysUser::getUserId, userId));
|
||||
if (user == null) {
|
||||
return R.failed(MsgUtils.getMessage(ErrorCodes.SYS_USER_USERINFO_EMPTY, userId));
|
||||
}
|
||||
return R.ok(userService.findUserInfo(user));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前用户全部信息
|
||||
*
|
||||
@@ -314,6 +329,7 @@ public class SysUserController {
|
||||
|
||||
/**
|
||||
* 根据浙政钉号和手机号查询
|
||||
*
|
||||
* @param employeeCode
|
||||
* @param mobile
|
||||
* @return
|
||||
|
||||
+17
@@ -49,6 +49,7 @@ import com.bsd.pjcloud.common.data.resolver.ParamResolver;
|
||||
import com.bsd.pjcloud.common.excel.vo.ErrorMessage;
|
||||
import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
import com.bsd.pjcloud.common.security.util.SecurityUtils;
|
||||
import com.bsd.pjcloud.wallet.api.feign.RemoteWalletService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@@ -90,6 +91,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
|
||||
private final CacheManager cacheManager;
|
||||
|
||||
private final RemoteWalletService remoteWalletService;
|
||||
|
||||
/**
|
||||
* 保存用户信息
|
||||
*
|
||||
@@ -135,6 +138,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
userRole.setRoleId(roleId);
|
||||
return userRole;
|
||||
}).forEach(sysUserRoleMapper::insert);
|
||||
|
||||
// 创建用户默认钱包
|
||||
remoteWalletService.createWallet(userDto.getUserId());
|
||||
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@@ -155,6 +162,13 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
.collect(Collectors.toList());
|
||||
userInfo.setRoles(ArrayUtil.toArray(roleIds, Long.class));
|
||||
|
||||
// 设置角色列表 (CODE)
|
||||
List<String> roleCodes = sysRoleService.findRolesByUserId(sysUser.getUserId())
|
||||
.stream()
|
||||
.map(SysRole::getRoleCode)
|
||||
.collect(Collectors.toList());
|
||||
userInfo.setRoleCodes(ArrayUtil.toArray(roleCodes, String.class));
|
||||
|
||||
// 设置权限列表(menu.permission)
|
||||
Set<String> permissions = new HashSet<>();
|
||||
roleIds.forEach(roleId -> {
|
||||
@@ -267,6 +281,9 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
}).forEach(SysUserPost::insert);
|
||||
}
|
||||
|
||||
// 创建用户默认钱包
|
||||
remoteWalletService.createWallet(userDto.getUserId());
|
||||
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
|
||||
+65
-64
@@ -30,88 +30,89 @@ import java.util.concurrent.TimeUnit;
|
||||
*/
|
||||
public class WxMpInRedisConfigStorage extends WxMpDefaultConfigImpl {
|
||||
|
||||
private final static String ACCESS_TOKEN_KEY = "wechat:access_token_";
|
||||
private final static String ACCESS_TOKEN_KEY = "wechat:access_token_";
|
||||
|
||||
private final static String JSAPI_TICKET_KEY = "wechat:jsapi_ticket_";
|
||||
private final static String JSAPI_TICKET_KEY = "wechat:jsapi_ticket_";
|
||||
|
||||
private final static String CARDAPI_TICKET_KEY = "wechat:cardapi_ticket_";
|
||||
private final static String CARDAPI_TICKET_KEY = "wechat:cardapi_ticket_";
|
||||
|
||||
private final RedisTemplate<String, String> redisTemplate;
|
||||
private final RedisTemplate<String, String> redisTemplate;
|
||||
|
||||
private String accessTokenKey;
|
||||
private String accessTokenKey;
|
||||
|
||||
private String jsapiTicketKey;
|
||||
private String jsapiTicketKey;
|
||||
|
||||
private String cardapiTicketKey;
|
||||
private String cardapiTicketKey;
|
||||
|
||||
public WxMpInRedisConfigStorage(RedisTemplate redisTemplate) {
|
||||
this.redisTemplate = redisTemplate;
|
||||
}
|
||||
public WxMpInRedisConfigStorage(RedisTemplate redisTemplate) {
|
||||
this.redisTemplate = redisTemplate;
|
||||
}
|
||||
|
||||
/**
|
||||
* 每个公众号生成独有的存储key
|
||||
* @param appId
|
||||
*/
|
||||
@Override
|
||||
public void setAppId(String appId) {
|
||||
super.setAppId(appId);
|
||||
this.accessTokenKey = ACCESS_TOKEN_KEY.concat(appId);
|
||||
this.jsapiTicketKey = JSAPI_TICKET_KEY.concat(appId);
|
||||
this.cardapiTicketKey = CARDAPI_TICKET_KEY.concat(appId);
|
||||
}
|
||||
/**
|
||||
* 每个公众号生成独有的存储key
|
||||
*
|
||||
* @param appId
|
||||
*/
|
||||
@Override
|
||||
public void setAppId(String appId) {
|
||||
super.setAppId(appId);
|
||||
this.accessTokenKey = ACCESS_TOKEN_KEY.concat(appId);
|
||||
this.jsapiTicketKey = JSAPI_TICKET_KEY.concat(appId);
|
||||
this.cardapiTicketKey = CARDAPI_TICKET_KEY.concat(appId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAccessToken() {
|
||||
return redisTemplate.opsForValue().get(this.accessTokenKey);
|
||||
}
|
||||
@Override
|
||||
public String getAccessToken() {
|
||||
return redisTemplate.opsForValue().get(this.accessTokenKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAccessTokenExpired() {
|
||||
return redisTemplate.getExpire(accessTokenKey) < 2L;
|
||||
}
|
||||
@Override
|
||||
public boolean isAccessTokenExpired() {
|
||||
return redisTemplate.getExpire(accessTokenKey) < 2L;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void updateAccessToken(String accessToken, int expiresInSeconds) {
|
||||
redisTemplate.opsForValue().set(accessTokenKey, accessToken, expiresInSeconds - 200, TimeUnit.SECONDS);
|
||||
}
|
||||
@Override
|
||||
public synchronized void updateAccessToken(String accessToken, int expiresInSeconds) {
|
||||
redisTemplate.opsForValue().set(accessTokenKey, accessToken, expiresInSeconds - 200, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void expireAccessToken() {
|
||||
redisTemplate.expire(this.accessTokenKey, 0, TimeUnit.SECONDS);
|
||||
}
|
||||
@Override
|
||||
public void expireAccessToken() {
|
||||
redisTemplate.expire(this.accessTokenKey, 0, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getJsapiTicket() {
|
||||
return redisTemplate.opsForValue().get(this.jsapiTicketKey);
|
||||
}
|
||||
@Override
|
||||
public String getJsapiTicket() {
|
||||
return redisTemplate.opsForValue().get(this.jsapiTicketKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCardApiTicket() {
|
||||
return redisTemplate.opsForValue().get(cardapiTicketKey);
|
||||
}
|
||||
@Override
|
||||
public String getCardApiTicket() {
|
||||
return redisTemplate.opsForValue().get(cardapiTicketKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTicket(TicketType type) {
|
||||
return redisTemplate.opsForValue().get(getTicketRedisKey(type));
|
||||
}
|
||||
@Override
|
||||
public String getTicket(TicketType type) {
|
||||
return redisTemplate.opsForValue().get(getTicketRedisKey(type));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTicketExpired(TicketType type) {
|
||||
return redisTemplate.getExpire(this.getTicketRedisKey(type)) < 2;
|
||||
}
|
||||
@Override
|
||||
public boolean isTicketExpired(TicketType type) {
|
||||
return redisTemplate.getExpire(this.getTicketRedisKey(type)) < 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void updateTicket(TicketType type, String jsapiTicket, int expiresInSeconds) {
|
||||
redisTemplate.opsForValue().set(getTicketRedisKey(type), jsapiTicket, expiresInSeconds - 200, TimeUnit.SECONDS);
|
||||
}
|
||||
@Override
|
||||
public synchronized void updateTicket(TicketType type, String jsapiTicket, int expiresInSeconds) {
|
||||
redisTemplate.opsForValue().set(getTicketRedisKey(type), jsapiTicket, expiresInSeconds - 200, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void expireTicket(TicketType type) {
|
||||
redisTemplate.expire(getTicketRedisKey(type), 0, TimeUnit.SECONDS);
|
||||
}
|
||||
@Override
|
||||
public void expireTicket(TicketType type) {
|
||||
redisTemplate.expire(getTicketRedisKey(type), 0, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
private String getTicketRedisKey(TicketType type) {
|
||||
return String.format("wechat:ticket:key:%s:%s", this.appId, type.getCode());
|
||||
}
|
||||
private String getTicketRedisKey(TicketType type) {
|
||||
return String.format("wechat:ticket:key:%s:%s", this.appId, type.getCode());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -26,7 +26,7 @@
|
||||
<!--mybatis plus extension,包含了mybatis plus core-->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-extension</artifactId>
|
||||
<artifactId>mybatis-plus-spring</artifactId>
|
||||
</dependency>
|
||||
<!--feign 工具类-->
|
||||
<dependency>
|
||||
@@ -38,5 +38,19 @@
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-common-excel</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<!--字段审计注解-->
|
||||
<dependency>
|
||||
<groupId>org.javers</groupId>
|
||||
<artifactId>javers-core</artifactId>
|
||||
</dependency>
|
||||
<!-- 脱敏工具类-->
|
||||
<dependency>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-common-sensitive</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-upms-api</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package com.bsd.pjcloud.wallet.api.constant;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@Getter
|
||||
public enum WalletBizEnum {
|
||||
UPDATE("1", "更新余额"),
|
||||
BATCH("2", "批量更新余额"),
|
||||
RECHARGE("3", "充值"),
|
||||
;
|
||||
private final String code;
|
||||
|
||||
private final String desc;
|
||||
|
||||
WalletBizEnum(String code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public static WalletBizEnum descOf(String description) {
|
||||
return Arrays.stream(WalletBizEnum.values())
|
||||
.filter(v -> ObjectUtil.equal(v.getDesc(), description))
|
||||
.findFirst().get();
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package com.bsd.pjcloud.wallet.api.constant;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@Getter
|
||||
public enum WalletTypeCodeEnum {
|
||||
SUPERMARKET("1", "超市"),
|
||||
CANTEEN("2", "食堂"),
|
||||
;
|
||||
private final String code;
|
||||
|
||||
private final String desc;
|
||||
|
||||
WalletTypeCodeEnum(String code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public static WalletTypeCodeEnum descOf(String description) {
|
||||
return Arrays.stream(WalletTypeCodeEnum.values())
|
||||
.filter(v -> ObjectUtil.equal(v.getDesc(), description))
|
||||
.findFirst().get();
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package com.bsd.pjcloud.wallet.api.constant;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@Getter
|
||||
public enum WalletTypeEnum {
|
||||
|
||||
EAT("1", "饭卡钱包"),
|
||||
PAY("2", "虚拟钱包"),
|
||||
;
|
||||
|
||||
private final String code;
|
||||
|
||||
private final String desc;
|
||||
|
||||
WalletTypeEnum(String code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public static WalletTypeEnum descOf(String description) {
|
||||
return Arrays.stream(WalletTypeEnum.values())
|
||||
.filter(v -> ObjectUtil.equal(v.getDesc(), description))
|
||||
.findFirst().get();
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package com.bsd.pjcloud.wallet.api.dto;
|
||||
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletManageEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
public class WalletManageDto extends WalletManageEntity {
|
||||
|
||||
}
|
||||
+140
@@ -0,0 +1,140 @@
|
||||
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-30 09:06:35
|
||||
*/
|
||||
@Data
|
||||
@TenantTable
|
||||
@TableName("wallet_manage")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(description = "钱包管理")
|
||||
public class WalletManageEntity extends Model<WalletManageEntity> {
|
||||
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description = "主键")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 饭卡绑定的用户id
|
||||
*/
|
||||
@Schema(description = "饭卡绑定的用户id")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 饭卡类型id
|
||||
*/
|
||||
@Schema(description = "饭卡类型id")
|
||||
private Long walletTypeId;
|
||||
|
||||
/**
|
||||
* 部门id
|
||||
*/
|
||||
@Schema(description = "部门id")
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 饭卡卡号
|
||||
*/
|
||||
@Schema(description = "饭卡卡号")
|
||||
private String cardNumber;
|
||||
|
||||
/**
|
||||
* 余额,单位分
|
||||
*/
|
||||
@Schema(description = "余额,单位分")
|
||||
private Integer balance;
|
||||
|
||||
/**
|
||||
* 累计支出,单位分
|
||||
*/
|
||||
@Schema(description = "累计支出,单位分")
|
||||
private Integer totalExpense;
|
||||
|
||||
/**
|
||||
* 累计充值,单位分
|
||||
*/
|
||||
@Schema(description = "累计充值,单位分")
|
||||
private Integer totalRecharge;
|
||||
|
||||
/**
|
||||
* 冻结金额,单位分
|
||||
*/
|
||||
@Schema(description = "冻结金额,单位分")
|
||||
private Integer freezePrice;
|
||||
|
||||
/**
|
||||
* 是否冻结饭卡
|
||||
*/
|
||||
@Schema(description = "是否冻结饭卡")
|
||||
private Boolean isFreeze;
|
||||
|
||||
/**
|
||||
* 绑定饭卡时间
|
||||
*/
|
||||
@Schema(description = "绑定饭卡时间")
|
||||
private LocalDateTime activeBindTime;
|
||||
|
||||
/**
|
||||
* 饭卡绑定状态
|
||||
*/
|
||||
@Schema(description = "饭卡绑定状态")
|
||||
private Integer activeBindStatus;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@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;
|
||||
}
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* 会员钱包流水表
|
||||
*
|
||||
* @author pjcloud
|
||||
* @date 2024-12-30 09:17:49
|
||||
*/
|
||||
@Data
|
||||
@TableName("wallet_transaction")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(description = "会员钱包流水表")
|
||||
public class WalletTransactionEntity extends Model<WalletTransactionEntity> {
|
||||
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description="编号")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 会员钱包 id
|
||||
*/
|
||||
@Schema(description="会员钱包 id")
|
||||
private Long walletId;
|
||||
|
||||
/**
|
||||
* 关联类型
|
||||
*/
|
||||
@Schema(description="关联类型")
|
||||
private String bizType;
|
||||
|
||||
/**
|
||||
* 关联业务编号
|
||||
*/
|
||||
@Schema(description="关联业务编号")
|
||||
private String bizId;
|
||||
|
||||
/**
|
||||
* 流水号
|
||||
*/
|
||||
@Schema(description="流水号")
|
||||
private String no;
|
||||
|
||||
/**
|
||||
* 流水标题
|
||||
*/
|
||||
@Schema(description="流水标题")
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 交易金额, 单位分
|
||||
*/
|
||||
@Schema(description="交易金额, 单位分")
|
||||
private Integer price;
|
||||
|
||||
/**
|
||||
* 余额, 单位分
|
||||
*/
|
||||
@Schema(description="余额, 单位分")
|
||||
private Integer balance;
|
||||
}
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
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-30 09:13:18
|
||||
*/
|
||||
@Data
|
||||
@TenantTable
|
||||
@TableName("wallet_type")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(description = "钱包类型")
|
||||
public class WalletTypeEntity extends Model<WalletTypeEntity> {
|
||||
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description="主键")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 钱包名
|
||||
*/
|
||||
@Schema(description="钱包名")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 钱包图标
|
||||
*/
|
||||
@Schema(description="钱包图标")
|
||||
private String icon;
|
||||
|
||||
/**
|
||||
* 饭卡code
|
||||
*/
|
||||
@Schema(description="饭卡code")
|
||||
private String uniqueCode;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@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;
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package com.bsd.pjcloud.wallet.api.feign;
|
||||
|
||||
import com.bsd.pjcloud.common.core.constant.ServiceNameConstants;
|
||||
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.entity.WalletManageEntity;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
@FeignClient(contextId = "remoteWalletService", value = ServiceNameConstants.WALLET_SERVICE)
|
||||
public interface RemoteWalletService {
|
||||
|
||||
@NoToken
|
||||
@GetMapping("/wallet-manage/get-or-create-wallet")
|
||||
R<WalletManageEntity> getOrCreateWallet(@RequestParam Long userId, @RequestParam(required = false) WalletTypeCodeEnum walletTypeCode);
|
||||
|
||||
@NoToken
|
||||
@GetMapping("/wallet-manage/get-wallet")
|
||||
R<WalletManageEntity> getWallet(@RequestParam Long userId, @RequestParam WalletTypeCodeEnum walletTypeCode);
|
||||
|
||||
@NoToken
|
||||
@GetMapping("/wallet-manage/create-wallet")
|
||||
R<Object> createWallet(@RequestParam Long userId);
|
||||
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
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.WalletManageEntity;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@Data
|
||||
public class WalletManageVo extends WalletManageEntity implements BaseUserInterface, BaseDeptInterface {
|
||||
|
||||
/**
|
||||
* 钱包类型名
|
||||
*/
|
||||
private String walletTypeName;
|
||||
|
||||
private String walletTypeUniqueCode;
|
||||
|
||||
/**
|
||||
* 用户相关
|
||||
*/
|
||||
private String username;
|
||||
|
||||
private String userMobile;
|
||||
|
||||
private String userAvatar;
|
||||
|
||||
/**
|
||||
* 部门相关
|
||||
*/
|
||||
private String deptName;
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
com.bsd.pjcloud.wallet.api.feign.RemoteWalletService
|
||||
+170
@@ -0,0 +1,170 @@
|
||||
package com.bsd.pjcloud.wallet.controller;
|
||||
|
||||
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.entity.SysUser;
|
||||
import com.bsd.pjcloud.common.core.exception.ErrorCodes;
|
||||
import com.bsd.pjcloud.common.core.util.MsgUtils;
|
||||
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.WalletManageDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletManageEntity;
|
||||
import com.bsd.pjcloud.wallet.service.WalletManageService;
|
||||
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-30 09:06:35
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/wallet-manage")
|
||||
@Tag(description = "walletManage", name = "钱包管理管理")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class WalletManageController {
|
||||
|
||||
private final WalletManageService walletManageService;
|
||||
|
||||
/* ************************************* start 远程调用 start ************************************* */
|
||||
|
||||
@Inner
|
||||
@GetMapping("/get-or-create-wallet")
|
||||
public R getOrCreateWallet(@RequestParam Long userId, @RequestParam WalletTypeCodeEnum walletTypeCode) {
|
||||
WalletManageEntity wallet = walletManageService.getOrCreateWallet(userId, walletTypeCode);
|
||||
if (ObjectUtil.isEmpty(wallet)) {
|
||||
return R.failed("用户钱包不存在");
|
||||
}
|
||||
return R.ok(wallet);
|
||||
}
|
||||
|
||||
@Inner
|
||||
@GetMapping("/create-wallet")
|
||||
public R getWallet(@RequestParam Long userId) {
|
||||
walletManageService.createWallet(userId);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Inner
|
||||
@GetMapping("/get-wallet")
|
||||
public R getWallet(@RequestParam Long userId, @RequestParam WalletTypeCodeEnum walletTypeCode) {
|
||||
WalletManageEntity wallet = walletManageService.getWallet(userId, walletTypeCode);
|
||||
if (ObjectUtil.isEmpty(wallet)) {
|
||||
return R.failed("用户钱包不存在");
|
||||
}
|
||||
return R.ok(wallet);
|
||||
}
|
||||
|
||||
/* ************************************* start 远程调用 start ************************************* */
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param walletManage 钱包管理
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletManage_view')")
|
||||
public R getWalletManagePage(@ParameterObject Page page, @ParameterObject WalletManageEntity walletManage) {
|
||||
LambdaQueryWrapper<WalletManageEntity> wrapper = Wrappers.lambdaQuery();
|
||||
return R.ok(walletManageService.page(page, wrapper));
|
||||
}
|
||||
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page-join")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletManage_view')")
|
||||
public R getWalletManagePageJoin(@ParameterObject Page page, @ParameterObject WalletManageDto dto) {
|
||||
return walletManageService.pageJoin(page, dto);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id查询钱包管理
|
||||
*
|
||||
* @param id id
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@GetMapping("/{id}")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletManage_view')")
|
||||
public R getById(@PathVariable("id") Long id) {
|
||||
return R.ok(walletManageService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增钱包管理
|
||||
*
|
||||
* @param walletManage 钱包管理
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "新增钱包管理", description = "新增钱包管理")
|
||||
@SysLog("新增钱包管理")
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletManage_add')")
|
||||
public R save(@RequestBody WalletManageEntity walletManage) {
|
||||
return R.ok(walletManageService.save(walletManage));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改钱包管理
|
||||
*
|
||||
* @param walletManage 钱包管理
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "修改钱包管理", description = "修改钱包管理")
|
||||
@SysLog("修改钱包管理")
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletManage_edit')")
|
||||
public R updateById(@RequestBody WalletManageEntity walletManage) {
|
||||
return R.ok(walletManageService.updateById(walletManage));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除钱包管理
|
||||
*
|
||||
* @param ids id列表
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过id删除钱包管理", description = "通过id删除钱包管理")
|
||||
@SysLog("通过id删除钱包管理")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletManage_del')")
|
||||
public R removeById(@RequestBody Long[] ids) {
|
||||
return R.ok(walletManageService.removeBatchByIds(CollUtil.toList(ids)));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出excel 表格
|
||||
*
|
||||
* @param walletManage 查询条件
|
||||
* @param ids 导出指定ID
|
||||
* @return excel 文件流
|
||||
*/
|
||||
@ResponseExcel
|
||||
@GetMapping("/export")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletManage_export')")
|
||||
public List<WalletManageEntity> export(WalletManageEntity walletManage, Long[] ids) {
|
||||
return walletManageService.list(Wrappers.lambdaQuery(walletManage).in(ArrayUtil.isNotEmpty(ids), WalletManageEntity::getId, ids));
|
||||
}
|
||||
}
|
||||
+118
@@ -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.WalletTransactionEntity;
|
||||
import com.bsd.pjcloud.wallet.service.WalletTransactionService;
|
||||
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 pjcloud
|
||||
* @date 2024-12-30 09:17:49
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/walletTransaction" )
|
||||
@Tag(description = "walletTransaction" , name = "会员钱包流水表管理" )
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class WalletTransactionController {
|
||||
|
||||
private final WalletTransactionService walletTransactionService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page 分页对象
|
||||
* @param walletTransaction 会员钱包流水表
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "分页查询" , description = "分页查询" )
|
||||
@GetMapping("/page" )
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletTransaction_view')" )
|
||||
public R getWalletTransactionPage(@ParameterObject Page page, @ParameterObject WalletTransactionEntity walletTransaction) {
|
||||
LambdaQueryWrapper<WalletTransactionEntity> wrapper = Wrappers.lambdaQuery();
|
||||
return R.ok(walletTransactionService.page(page, wrapper));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id查询会员钱包流水表
|
||||
* @param id id
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过id查询" , description = "通过id查询" )
|
||||
@GetMapping("/{id}" )
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletTransaction_view')" )
|
||||
public R getById(@PathVariable("id" ) Long id) {
|
||||
return R.ok(walletTransactionService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增会员钱包流水表
|
||||
* @param walletTransaction 会员钱包流水表
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "新增会员钱包流水表" , description = "新增会员钱包流水表" )
|
||||
@SysLog("新增会员钱包流水表" )
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletTransaction_add')" )
|
||||
public R save(@RequestBody WalletTransactionEntity walletTransaction) {
|
||||
return R.ok(walletTransactionService.save(walletTransaction));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改会员钱包流水表
|
||||
* @param walletTransaction 会员钱包流水表
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "修改会员钱包流水表" , description = "修改会员钱包流水表" )
|
||||
@SysLog("修改会员钱包流水表" )
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletTransaction_edit')" )
|
||||
public R updateById(@RequestBody WalletTransactionEntity walletTransaction) {
|
||||
return R.ok(walletTransactionService.updateById(walletTransaction));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除会员钱包流水表
|
||||
* @param ids id列表
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过id删除会员钱包流水表" , description = "通过id删除会员钱包流水表" )
|
||||
@SysLog("通过id删除会员钱包流水表" )
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletTransaction_del')" )
|
||||
public R removeById(@RequestBody Long[] ids) {
|
||||
return R.ok(walletTransactionService.removeBatchByIds(CollUtil.toList(ids)));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出excel 表格
|
||||
* @param walletTransaction 查询条件
|
||||
* @param ids 导出指定ID
|
||||
* @return excel 文件流
|
||||
*/
|
||||
@ResponseExcel
|
||||
@GetMapping("/export")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletTransaction_export')" )
|
||||
public List<WalletTransactionEntity> export(WalletTransactionEntity walletTransaction,Long[] ids) {
|
||||
return walletTransactionService.list(Wrappers.lambdaQuery(walletTransaction).in(ArrayUtil.isNotEmpty(ids), WalletTransactionEntity::getId, ids));
|
||||
}
|
||||
}
|
||||
+119
@@ -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.WalletTypeEntity;
|
||||
import com.bsd.pjcloud.wallet.service.WalletTypeService;
|
||||
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-30 09:13:18
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/walletType" )
|
||||
@Tag(description = "walletType" , name = "钱包类型管理" )
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class WalletTypeController {
|
||||
|
||||
private final WalletTypeService walletTypeService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page 分页对象
|
||||
* @param walletType 钱包类型
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "分页查询" , description = "分页查询" )
|
||||
@GetMapping("/page" )
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletType_view')" )
|
||||
public R getWalletTypePage(@ParameterObject Page page, @ParameterObject WalletTypeEntity walletType) {
|
||||
LambdaQueryWrapper<WalletTypeEntity> wrapper = Wrappers.lambdaQuery();
|
||||
return R.ok(walletTypeService.page(page, wrapper));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id查询钱包类型
|
||||
* @param id id
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过id查询" , description = "通过id查询" )
|
||||
@GetMapping("/{id}" )
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletType_view')" )
|
||||
public R getById(@PathVariable("id" ) Long id) {
|
||||
return R.ok(walletTypeService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增钱包类型
|
||||
* @param walletType 钱包类型
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "新增钱包类型" , description = "新增钱包类型" )
|
||||
@SysLog("新增钱包类型" )
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletType_add')" )
|
||||
public R save(@RequestBody WalletTypeEntity walletType) {
|
||||
return R.ok(walletTypeService.save(walletType));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改钱包类型
|
||||
* @param walletType 钱包类型
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "修改钱包类型" , description = "修改钱包类型" )
|
||||
@SysLog("修改钱包类型" )
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletType_edit')" )
|
||||
public R updateById(@RequestBody WalletTypeEntity walletType) {
|
||||
return R.ok(walletTypeService.updateById(walletType));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除钱包类型
|
||||
* @param ids id列表
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过id删除钱包类型" , description = "通过id删除钱包类型" )
|
||||
@SysLog("通过id删除钱包类型" )
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletType_del')" )
|
||||
public R removeById(@RequestBody Long[] ids) {
|
||||
return R.ok(walletTypeService.removeBatchByIds(CollUtil.toList(ids)));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出excel 表格
|
||||
* @param walletType 查询条件
|
||||
* @param ids 导出指定ID
|
||||
* @return excel 文件流
|
||||
*/
|
||||
@ResponseExcel
|
||||
@GetMapping("/export")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletType_export')" )
|
||||
public List<WalletTypeEntity> export(WalletTypeEntity walletType,Long[] ids) {
|
||||
return walletTypeService.list(Wrappers.lambdaQuery(walletType).in(ArrayUtil.isNotEmpty(ids), WalletTypeEntity::getId, ids));
|
||||
}
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package com.bsd.pjcloud.wallet.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletManageDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletManageEntity;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletTypeEntity;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletManageVo;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@Mapper
|
||||
public interface WalletManageMapper extends PjcloudBaseMapper<WalletManageEntity> {
|
||||
default int updateWhenConsumption(Long id, Integer price) {
|
||||
LambdaUpdateWrapper<WalletManageEntity> lambdaUpdateWrapper = new LambdaUpdateWrapper<WalletManageEntity>()
|
||||
.setSql(" balance = balance - " + price + ", total_expense = total_expense + " + price)
|
||||
.eq(WalletManageEntity::getId, id)
|
||||
.ge(WalletManageEntity::getBalance, price);
|
||||
return update(null, lambdaUpdateWrapper);
|
||||
}
|
||||
|
||||
default int updateWhenRecharge(Long id, Integer price) {
|
||||
LambdaUpdateWrapper<WalletManageEntity> lambdaUpdateWrapper = new LambdaUpdateWrapper<WalletManageEntity>()
|
||||
.setSql(" balance = balance + " + price + ", total_recharge = total_recharge + " + price)
|
||||
.eq(WalletManageEntity::getId, id);
|
||||
return update(null, lambdaUpdateWrapper);
|
||||
}
|
||||
|
||||
default Page<WalletManageVo> pageJoin(Page<WalletManageVo> page, @Param("pa") WalletManageDto dto) {
|
||||
MPJLambdaWrapper<WalletManageEntity> wrapper = new MPJLambdaWrapper<WalletManageEntity>()
|
||||
.selectAll(WalletManageEntity.class)
|
||||
.selectAs(WalletTypeEntity::getName, WalletManageVo::getWalletTypeName)
|
||||
.selectAs(WalletTypeEntity::getUniqueCode, WalletManageVo::getWalletTypeUniqueCode)
|
||||
.leftJoin(WalletTypeEntity.class, WalletTypeEntity::getId, WalletManageEntity::getWalletTypeId)
|
||||
.eqIfExists(WalletManageEntity::getUserId, dto.getUserId())
|
||||
.eqIfExists(WalletManageEntity::getWalletTypeId, dto.getWalletTypeId())
|
||||
.eqIfExists(WalletManageEntity::getIsFreeze, dto.getIsFreeze())
|
||||
.likeIfExists(WalletManageEntity::getCardNumber, dto.getCardNumber());
|
||||
return selectJoinPage(page, WalletManageVo.class, wrapper);
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package com.bsd.pjcloud.wallet.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletTransactionEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface WalletTransactionMapper extends PjcloudBaseMapper<WalletTransactionEntity> {
|
||||
|
||||
|
||||
}
|
||||
+11
@@ -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.WalletTypeEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface WalletTypeMapper extends PjcloudBaseMapper<WalletTypeEntity> {
|
||||
|
||||
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
package com.bsd.pjcloud.wallet.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.wallet.api.constant.WalletTypeCodeEnum;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletManageDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletManageEntity;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
public interface WalletManageService extends IService<WalletManageEntity> {
|
||||
|
||||
/**
|
||||
* 创建钱包
|
||||
*
|
||||
* @param userId
|
||||
* @param checkPermission
|
||||
*/
|
||||
void createWallet(@NotNull Long userId, @NotNull Boolean checkPermission);
|
||||
|
||||
/**
|
||||
* 创建钱包
|
||||
*
|
||||
* @param userId
|
||||
*/
|
||||
void createWallet(@NotNull Long userId);
|
||||
|
||||
/**
|
||||
* 获取钱包没有就创建用户钱包(没有缓存)
|
||||
*
|
||||
* @param userId
|
||||
*/
|
||||
WalletManageEntity getOrCreateWallet(@NotNull Long userId, @NotNull WalletTypeCodeEnum walletTypeCode);
|
||||
|
||||
/**
|
||||
* 获取钱包(有缓存)
|
||||
* @param userId
|
||||
* @param walletTypeCode
|
||||
* @return
|
||||
*/
|
||||
WalletManageEntity getWallet(@NotNull Long userId, @NotNull WalletTypeCodeEnum walletTypeCode);
|
||||
|
||||
|
||||
/**
|
||||
* 分页连表查询
|
||||
*
|
||||
* @param page
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
R pageJoin(Page page, WalletManageDto dto);
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package com.bsd.pjcloud.wallet.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.wallet.api.constant.WalletBizEnum;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletTransactionEntity;
|
||||
|
||||
public interface WalletTransactionService extends IService<WalletTransactionEntity> {
|
||||
|
||||
/**
|
||||
* 扣减钱包余额
|
||||
*
|
||||
* @param walletId 钱包 id
|
||||
* @param price 扣减金额
|
||||
* @param bizId 业务关联 id
|
||||
* @param bizType 业务关联分类
|
||||
* @return 钱包流水
|
||||
*/
|
||||
WalletTransactionEntity reduceWalletBalance(Long walletId, Integer price, Long bizId, WalletBizEnum bizType);
|
||||
|
||||
|
||||
/**
|
||||
* 增加钱包余额
|
||||
*
|
||||
* @param walletId 钱包 id
|
||||
* @param price 增加金额
|
||||
* @param bizId 业务关联 id
|
||||
* @param bizType 业务关联分类
|
||||
* @return 钱包流水
|
||||
*/
|
||||
WalletTransactionEntity addWalletBalance(Long walletId, Integer price, String bizId, WalletBizEnum bizType);
|
||||
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package com.bsd.pjcloud.wallet.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.wallet.api.constant.WalletTypeCodeEnum;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletTypeEntity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public interface WalletTypeService extends IService<WalletTypeEntity> {
|
||||
|
||||
WalletTypeEntity getByUniqueCode(WalletTypeCodeEnum walletTypeCodeEnum);
|
||||
|
||||
}
|
||||
+144
@@ -0,0 +1,144 @@
|
||||
package com.bsd.pjcloud.wallet.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
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.dto.UserInfo;
|
||||
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.CacheConstants;
|
||||
import com.bsd.pjcloud.common.core.util.CollectionUtils;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.data.resolver.ParamResolver;
|
||||
import com.bsd.pjcloud.wallet.api.constant.WalletTypeCodeEnum;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletManageDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletManageEntity;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletTypeEntity;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletManageVo;
|
||||
import com.bsd.pjcloud.wallet.mapper.WalletManageMapper;
|
||||
import com.bsd.pjcloud.wallet.mapper.WalletTypeMapper;
|
||||
import com.bsd.pjcloud.wallet.service.WalletManageService;
|
||||
import com.bsd.pjcloud.wallet.service.WalletTypeService;
|
||||
import com.bsd.pjcloud.wallet.utils.ConvertUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.CachePut;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 钱包管理
|
||||
*
|
||||
* @author dzc
|
||||
* @date 2024-12-30 09:06:35
|
||||
*/
|
||||
@Validated
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class WalletManageServiceImpl extends ServiceImpl<WalletManageMapper, WalletManageEntity> implements WalletManageService {
|
||||
|
||||
static private final String TAG = "钱包管理";
|
||||
|
||||
private final WalletTypeMapper walletTypeMapper;
|
||||
|
||||
private final WalletTypeService walletTypeService;
|
||||
|
||||
private final RemoteUserService userService;
|
||||
private final RemoteDeptService deptService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void createWallet(Long userId, Boolean checkPermission) {
|
||||
UserInfo user = null;
|
||||
if (checkPermission) {
|
||||
user = userService.getByUserId(userId).getData();
|
||||
if (ObjectUtil.isEmpty(user)) {
|
||||
log.info("|{}|创建用户电子钱包失败,userId:{},用户id不存在", TAG, userId);
|
||||
return;
|
||||
}
|
||||
String role = Arrays.stream(user.getRoleCodes()).filter(v -> ObjectUtil.equals(v, ParamResolver.getStr("WALLET_AUTO_CREATE"))).findFirst().get();
|
||||
if (ObjectUtil.isEmpty(role)) {
|
||||
log.info("|{}|创建用户电子钱包失败,userId:{},没有{}权限", TAG, userId, "WALLET_AUTO_CREATE");
|
||||
return;
|
||||
}
|
||||
}
|
||||
List<WalletTypeEntity> list = walletTypeMapper.selectList(new LambdaQueryWrapper<>());
|
||||
if (ObjectUtil.isEmpty(list)) return;
|
||||
if (ObjectUtil.isEmpty(user)) user = userService.getByUserId(userId).getData();
|
||||
for (WalletTypeEntity v : list) {
|
||||
WalletManageEntity wallet = baseMapper.selectOne(new LambdaQueryWrapper<WalletManageEntity>()
|
||||
.eq(WalletManageEntity::getUserId, userId)
|
||||
.eq(WalletManageEntity::getWalletTypeId, v.getId())
|
||||
);
|
||||
if (ObjectUtil.isNotEmpty(wallet)) continue;
|
||||
WalletManageEntity insertObj = new WalletManageEntity();
|
||||
insertObj.setUserId(userId);
|
||||
insertObj.setWalletTypeId(v.getId());
|
||||
insertObj.setDeptId(user.getSysUser().getDeptId());
|
||||
baseMapper.insert(insertObj);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createWallet(Long userId) {
|
||||
getSelf().createWallet(userId, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CachePut(value = CacheConstants.WALLET_DETAIL, key = "#userId-#walletTypeCode.name()", unless = "#result == null ")
|
||||
public WalletManageEntity getOrCreateWallet(Long userId, WalletTypeCodeEnum walletTypeCode) {
|
||||
WalletTypeEntity walletType = walletTypeService.getByUniqueCode(walletTypeCode);
|
||||
if (ObjectUtil.isEmpty(walletType)) return null;
|
||||
LambdaQueryWrapper<WalletManageEntity> walletQuery = new LambdaQueryWrapper<WalletManageEntity>().eq(WalletManageEntity::getUserId, userId).eq(WalletManageEntity::getWalletTypeId, walletType.getId());
|
||||
WalletManageEntity wallet = baseMapper.selectOne(walletQuery);
|
||||
if (ObjectUtil.isEmpty(wallet)) createWallet(userId);
|
||||
return baseMapper.selectOne(walletQuery);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Cacheable(value = CacheConstants.WALLET_DETAIL, key = "#userId-#walletTypeCode.name()", unless = "#result == null ")
|
||||
public WalletManageEntity getWallet(Long userId, WalletTypeCodeEnum walletTypeCode) {
|
||||
WalletTypeEntity walletType = walletTypeService.getByUniqueCode(walletTypeCode);
|
||||
if (ObjectUtil.isEmpty(walletType)) return null;
|
||||
return baseMapper.selectOne(new LambdaQueryWrapper<WalletManageEntity>()
|
||||
.eq(WalletManageEntity::getUserId, userId)
|
||||
.eq(WalletManageEntity::getWalletTypeId, walletType.getId())
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R pageJoin(Page page, WalletManageDto dto) {
|
||||
Page<WalletManageVo> list = baseMapper.pageJoin(page, dto);
|
||||
if (ObjectUtil.isNotEmpty(list.getRecords())) {
|
||||
// 用户
|
||||
List<Long> userIds = list.getRecords().stream().map(WalletManageVo::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(WalletManageVo::getDeptId).distinct().toList();
|
||||
R<Map<Long, SysDept>> deptList = deptService.getDeptByDeptIds(deptIds);
|
||||
if (ObjectUtil.isNotEmpty(deptList.getData())) {
|
||||
DataUtil.convertDeptList(page.getRecords(), deptList.getData());
|
||||
}
|
||||
}
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
private WalletManageServiceImpl getSelf() {
|
||||
return SpringUtil.getBean(getClass());
|
||||
}
|
||||
}
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
package com.bsd.pjcloud.wallet.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.common.core.exception.CheckedException;
|
||||
import com.bsd.pjcloud.wallet.api.constant.WalletBizEnum;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletManageEntity;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletTransactionEntity;
|
||||
import com.bsd.pjcloud.wallet.mapper.WalletManageMapper;
|
||||
import com.bsd.pjcloud.wallet.mapper.WalletTransactionMapper;
|
||||
import com.bsd.pjcloud.wallet.service.WalletManageService;
|
||||
import com.bsd.pjcloud.wallet.service.WalletTransactionService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
/**
|
||||
* 会员钱包流水表
|
||||
*
|
||||
* @author pjcloud
|
||||
* @date 2024-12-30 09:17:49
|
||||
*/
|
||||
@Validated
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class WalletTransactionServiceImpl extends ServiceImpl<WalletTransactionMapper, WalletTransactionEntity> implements WalletTransactionService {
|
||||
|
||||
static private final String TAG = "会员钱包流水";
|
||||
|
||||
private final WalletManageService walletManageService;
|
||||
|
||||
private final WalletManageMapper walletManageMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public boolean save(WalletTransactionEntity entity) {
|
||||
return baseMapper.insert(entity) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public WalletTransactionEntity reduceWalletBalance(Long walletId, Integer price, Long bizId, WalletBizEnum bizType) {
|
||||
WalletManageEntity wallet = walletManageService.getById(walletId);
|
||||
if (ObjectUtil.isEmpty(wallet)) {
|
||||
log.error("|{}|,用户钱包id({})不存在.", TAG, walletId);
|
||||
throw new CheckedException("扣款失败,用户钱包不存在");
|
||||
}
|
||||
int updateCounts = walletManageMapper.updateWhenConsumption(wallet.getId(), price);
|
||||
if (updateCounts == 0) {
|
||||
log.error("|{}|,用户钱包id({})余额不足.", TAG, walletId);
|
||||
throw new CheckedException("钱包余额不足");
|
||||
}
|
||||
Integer afterBalance = wallet.getBalance() - price;
|
||||
WalletTransactionEntity insetObj = new WalletTransactionEntity();
|
||||
insetObj.setWalletId(walletId);
|
||||
insetObj.setPrice(-price);
|
||||
insetObj.setBalance(afterBalance);
|
||||
insetObj.setBizId(String.valueOf(bizId));
|
||||
insetObj.setBizType(bizType.getCode());
|
||||
insetObj.setTitle(bizType.getDesc());
|
||||
save(insetObj);
|
||||
return insetObj;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public WalletTransactionEntity addWalletBalance(Long walletId, Integer price, String bizId, WalletBizEnum bizType) {
|
||||
WalletManageEntity wallet = walletManageService.getById(walletId);
|
||||
if (ObjectUtil.isEmpty(wallet)) {
|
||||
log.error("|{}|,用户钱包id({})不存在.", TAG, walletId);
|
||||
throw new CheckedException("扣款失败,用户钱包不存在");
|
||||
}
|
||||
switch (bizType) {
|
||||
case UPDATE:
|
||||
case BATCH:
|
||||
case RECHARGE: {
|
||||
walletManageMapper.updateWhenRecharge(wallet.getId(), price);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
log.error("|{}|,钱包id({})使用未实现的增加钱包余额的类型({}).", TAG, walletId, bizType.getDesc());
|
||||
throw new UnsupportedOperationException("待实现");
|
||||
}
|
||||
}
|
||||
WalletTransactionEntity insetObj = new WalletTransactionEntity();
|
||||
insetObj.setWalletId(walletId);
|
||||
insetObj.setPrice(-price);
|
||||
insetObj.setBalance(wallet.getBalance() + price);
|
||||
insetObj.setBizId(String.valueOf(bizId));
|
||||
insetObj.setBizType(bizType.getCode());
|
||||
insetObj.setTitle(bizType.getDesc());
|
||||
save(insetObj);
|
||||
return insetObj;
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package com.bsd.pjcloud.wallet.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.common.core.constant.CacheConstants;
|
||||
import com.bsd.pjcloud.wallet.api.constant.WalletTypeCodeEnum;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletTypeEntity;
|
||||
import com.bsd.pjcloud.wallet.mapper.WalletTypeMapper;
|
||||
import com.bsd.pjcloud.wallet.service.WalletTypeService;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 钱包类型
|
||||
*
|
||||
* @author dzc
|
||||
* @date 2024-12-30 09:13:18
|
||||
*/
|
||||
@Service
|
||||
public class WalletTypeServiceImpl extends ServiceImpl<WalletTypeMapper, WalletTypeEntity> implements WalletTypeService {
|
||||
|
||||
@Override
|
||||
public WalletTypeEntity getById(Serializable id) {
|
||||
return super.getById(id);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public WalletTypeEntity getByUniqueCode(WalletTypeCodeEnum walletTypeCodeEnum) {
|
||||
return baseMapper.selectOne(new LambdaQueryWrapper<WalletTypeEntity>()
|
||||
.eq(WalletTypeEntity::getUniqueCode, walletTypeCodeEnum.getCode())
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.bsd.pjcloud.wallet.utils;
|
||||
|
||||
import lombok.experimental.UtilityClass;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@UtilityClass
|
||||
public class ConvertUtil {
|
||||
|
||||
}
|
||||
@@ -9,7 +9,7 @@ spring:
|
||||
username: @nacos.username@
|
||||
password: @nacos.password@
|
||||
discovery:
|
||||
server-addr: 123.156.230.15:8848
|
||||
server-addr: ${NACOS_HOST:pjcloud-register}:${NACOS_PORT:8848}
|
||||
config:
|
||||
server-addr: ${spring.cloud.nacos.discovery.server-addr}
|
||||
config:
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
<?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.WalletManageMapper">
|
||||
|
||||
<resultMap id="walletManageMap" type="com.bsd.pjcloud.wallet.api.entity.WalletManageEntity">
|
||||
<id property="id" column="id"/>
|
||||
<result property="userId" column="user_id"/>
|
||||
<result property="walletTypeId" column="wallet_type_id"/>
|
||||
<result property="cardNumber" column="card_number"/>
|
||||
<result property="balance" column="balance"/>
|
||||
<result property="totalExpense" column="total_expense"/>
|
||||
<result property="totalRecharge" column="total_recharge"/>
|
||||
<result property="freezePrice" column="freeze_price"/>
|
||||
<result property="isFreeze" column="is_freeze"/>
|
||||
<result property="activeBindTime" column="active_bind_time"/>
|
||||
<result property="activeBindStatus" column="active_bind_status"/>
|
||||
<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>
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
<?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.WalletTransactionMapper">
|
||||
|
||||
<resultMap id="walletTransactionMap" type="com.bsd.pjcloud.wallet.api.entity.WalletTransactionEntity">
|
||||
<id property="id" column="id"/>
|
||||
<result property="walletId" column="wallet_id"/>
|
||||
<result property="bizType" column="biz_type"/>
|
||||
<result property="bizId" column="biz_id"/>
|
||||
<result property="no" column="no"/>
|
||||
<result property="title" column="title"/>
|
||||
<result property="price" column="price"/>
|
||||
<result property="balance" column="balance"/>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?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.WalletTypeMapper">
|
||||
|
||||
<resultMap id="walletTypeMap" type="com.bsd.pjcloud.wallet.api.entity.WalletTypeEntity">
|
||||
<id property="id" column="id"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="icon" column="icon"/>
|
||||
<result property="uniqueCode" column="unique_code"/>
|
||||
<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>
|
||||
Reference in new issue
Block a user