Merge remote-tracking branch 'origin/master'

This commit is contained in:
zjf committed 2025-03-31 17:01:23 +08:00
commit 2a1790c5d5
84 files changed
+2250 -332

No files matched your search

+80 -31
View File
@@ -64,23 +64,22 @@ CREATE INDEX idx_dept_id ON mch_manage (dept_id);
-- ----------------------------
-- Table structure for mch_dpet_user
-- ----------------------------
DROP TABLE IF EXISTS `mch_dept_user`;
CREATE TABLE mch_dept_user
DROP TABLE IF EXISTS `mch_dept`;
CREATE TABLE mch_dept
(
id bigint NOT NULL COMMENT '主键',
mch_id bigint NOT NULL COMMENT '商户id',
user_id bigint NOT NULL COMMENT '用户id',
user_dept_id bigint NOT NULL COMMENT '用户部门id',
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',
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 '修改时间',
del_flag CHAR default '0' null comment '删除标记',
tenant_id BIGINT(19) null comment '租户ID',
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT ='用户部门商户关系表';
COLLATE = utf8mb4_general_ci COMMENT ='商户部门关系表';
-- ----------------------------
-- Table structure for wallet_manage
@@ -113,15 +112,15 @@ CREATE TABLE wallet_manage
CREATE INDEX idx_dept_id ON wallet_manage (user_id);
-- ----------------------------
-- Table structure for wallet_rule_price_config
-- Table structure for mch_rule_price_config
-- ----------------------------
DROP TABLE IF EXISTS wallet_rule_price_config;
CREATE TABLE wallet_rule_price_config
DROP TABLE IF EXISTS mch_rule_price_config;
CREATE TABLE mch_rule_price_config
(
id bigint NOT NULL COMMENT '主键',
rule_price_type varchar(64) NOT NULL COMMENT '规则类型',
base_price bigint NOT NULL COMMENT '基础金额',
multiple bigint NOT NULL COMMENT '额外支付的倍数',
id BIGINT(19) not null comment '主键',
rule_price_type VARCHAR(64) not null comment '规则类型',
base_price BIGINT(19) not null comment '基础金额',
multiple BIGINT(19) not 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 '修改人',
@@ -133,16 +132,17 @@ CREATE TABLE wallet_rule_price_config
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '商家商品价格配置表';
-- ----------------------------
-- Table structure for wallet_rule_mch_config
-- Table structure for mch_rule_join
-- ----------------------------
DROP TABLE IF EXISTS wallet_rule_mch_config;
CREATE TABLE wallet_rule_mch_config
DROP TABLE IF EXISTS mch_rule_join;
CREATE TABLE mch_rule_join
(
id bigint NOT NULL COMMENT '主键',
source_mch_id bigint NOT NULL COMMENT '源商户id',
target_mch_id bigint NOT NULL COMMENT '目标商户id',
target_dept_id bigint NOT NULL COMMENT '目标部门id',
rule_price_config_id bigint NOT NULL COMMENT '规则配置id',
id BIGINT(19) not null comment '主键',
source_mch_id BIGINT(19) not null comment '源商户id',
target_mch_id BIGINT(19) not null comment '目标商户id',
target_dept_id BIGINT(19) not null comment '目标部门id',
rule_price_config_id BIGINT(19) not null comment '规则配置id',
status VARCHAR(64) default '0' not 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 '修改人',
@@ -159,10 +159,11 @@ CREATE TABLE wallet_rule_mch_config
DROP TABLE IF EXISTS wallet_type;
CREATE TABLE wallet_type
(
id bigint NOT NULL COMMENT '主键',
name varchar(64) NOT NULL COMMENT '钱包名',
icon varchar(256) NOT NULL COMMENT '钱包图标',
id bigint NOT NULL COMMENT '主键',
name varchar(64) NOT NULL COMMENT '钱包名',
icon varchar(256) NOT NULL COMMENT '钱包图标',
unique_code varchar(16) COMMENT '饭卡code',
is_rule char(1) DEFAULT '0' NOT 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 '修改人',
@@ -173,6 +174,54 @@ CREATE TABLE wallet_type
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 COMMENT ='钱包类型';
-- ----------------------------
-- Table structure for wallet_rule_join
-- ----------------------------
DROP TABLE IF EXISTS wallet_rule_join;
CREATE TABLE wallet_rule_join
(
id BIGINT(19) not null comment '主键',
source_wallet_type_id BIGINT(19) not null comment '源钱包类型id',
target_wallet_type_id BIGINT(19) not null comment '目标钱包类型id',
target_dept_id BIGINT(19) not null comment '目标部门id',
balance_multiple int DEFAULT 0 NOT NULL COMMENT '钱包转换百分比',
status VARCHAR(64) default '0' not null comment '是否启用',
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
create_time datetime DEFAULT NULL COMMENT '创建时间',
update_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
update_time datetime DEFAULT NULL COMMENT '修改时间',
del_flag char(1) COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记',
tenant_id bigint DEFAULT NULL COMMENT '租户ID',
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '钱包规则配置';
-- ----------------------------
-- Table structure for wallet_rule_transaction
-- ----------------------------
DROP TABLE IF EXISTS wallet_rule_transaction;
CREATE TABLE wallet_rule_transaction
(
id BIGINT(19) not null comment '主键',
source_wallet_id BIGINT(19) not null comment '源钱包id',
target_wallet_id BIGINT(19) not null comment '目标钱包id',
source_wallet_balance int not null comment '源钱包余额',
target_wallet_balance int not null comment '目标钱包余额',
balance int DEFAULT 0 NOT NULL COMMENT '转换金额',
after_balance int DEFAULT 0 NOT NULL COMMENT '转换后的金额',
balance_multiple int DEFAULT 0 NOT NULL COMMENT '钱包转换百分比',
is_refund VARCHAR(64) default '0' not null comment '是否退回',
create_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
create_time datetime DEFAULT NULL COMMENT '创建时间',
update_by varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人',
update_time datetime DEFAULT NULL COMMENT '修改时间',
del_flag char(1) COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标记',
tenant_id bigint DEFAULT NULL COMMENT '租户ID',
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '钱包转账记录';
-- ----------------------------
-- Table structure for wallet_active
@@ -7,8 +7,8 @@ import lombok.RequiredArgsConstructor;
@Getter
public enum MerchantTypeEnum {
CANTEEN("1", "食堂"),
SUPERMARKET("2", "合作超市"),
SELF_SUPERMARKET("3", "自营超市"),
SUPERMARKET("2", "合作商家"),
SELF_SUPERMARKET("3", "自营商家"),
;
/**
@@ -30,7 +30,6 @@ import com.bsd.pjcloud.hard.service.HardManagerService;
import com.bsd.pjcloud.hard.mqtt.config.MqttConfig;
import com.bsd.pjcloud.hard.utils.MqTopicUtil;
import com.bsd.pjcloud.mqtt.api.feign.RemoteMqttEventService;
import com.bsd.pjcloud.wallet.api.entity.MchManageEntity;
import com.bsd.pjcloud.wallet.api.feign.RemoteMchService;
import com.bsd.pjcloud.wallet.api.utils.WalletDataUtil;
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
@@ -13,4 +13,6 @@ public class DeptAllListDto {
private Boolean isInclude;
private String isSyncZy;
}
@@ -54,6 +54,10 @@ public interface RemoteDeptService {
@PostMapping("/dept/inner-all-dept")
R<List<SysDept>> getInnerAllDept(@RequestBody DeptAllListDto dto);
@NoToken
@PostMapping("/dept/inner-dept")
R<List<SysDept>> getInnerDept(@RequestBody DeptAllListDto dto);
/**
* 通过部门ID获取负责人列表
*
@@ -40,6 +40,7 @@ import java.util.Set;
@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.UPMS_SERVICE)
public interface RemoteUserService {
@NoToken
@PostMapping("/user/inner-page")
R<List<UserVO>> getRemoteUserPage(@RequestParam Long current, @RequestParam Long size, @RequestBody UserDTO userDTO);
@@ -225,4 +225,12 @@ public class SysDeptController {
public R<List<SysDept>> getInnerAllDept(@RequestBody DeptAllListDto dto) {
return R.ok(sysDeptMapper.allList(dto));
}
@Inner
@PostMapping("/inner-dept")
public R<List<SysDept>> getInnerDept(@RequestBody DeptAllListDto dto) {
return R.ok(sysDeptService.getInnerDept(dto));
}
}
@@ -211,15 +211,16 @@ public class SysUserController {
/**
* 分页查询用户
*/
@Inner
@PostMapping("/inner-page")
public R<List<UserVO>> getRemoteUserPage(@RequestParam Long current, @RequestParam Long size, @RequestBody UserDTO userDTO) {
public R<List<UserVO>> innerPage(@RequestParam Long current, @RequestParam Long size, @RequestBody UserDTO userDTO) {
if (ObjectUtil.isEmpty(userDTO.getIsFindCheckUser())) {
userDTO.setIsFindCheckUser(true);
}
Page pageParams = new Page();
pageParams.setCurrent(current);
pageParams.setSize(size);
return R.ok(userService.getUsersWithRolePage(pageParams, userDTO).getRecords());
return R.ok(userService.innerPage(pageParams, userDTO).getRecords());
}
/**
@@ -21,6 +21,7 @@ package com.bsd.pjcloud.admin.service;
import cn.hutool.core.lang.tree.Tree;
import com.baomidou.mybatisplus.extension.service.IService;
import com.bsd.pjcloud.admin.api.dto.DeptAllListDto;
import com.bsd.pjcloud.admin.api.entity.SysDept;
import com.bsd.pjcloud.admin.api.vo.DeptExcelVO;
import com.bsd.pjcloud.admin.api.vo.OrgTreeVO;
@@ -127,4 +128,6 @@ public interface SysDeptService extends IService<SysDept> {
*/
List<SysDept> selectByNames(List<String> names);
List<SysDept> getInnerDept(DeptAllListDto dto);
}
@@ -61,6 +61,8 @@ public interface SysUserService extends IService<SysUser> {
*/
IPage<UserVO> getUsersWithRolePage(Page page, UserDTO userDTO);
IPage<UserVO> innerPage(Page page, UserDTO userDTO);
/**
* 删除用户
*
@@ -214,6 +216,7 @@ public interface SysUserService extends IService<SysUser> {
/**
* 根据用户名或者手机号获取数据库权限的用户信息
*
* @param eq
* @return
*/
@@ -31,6 +31,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bsd.pjcloud.admin.api.constant.OrgTypeEnum;
import com.bsd.pjcloud.admin.api.constant.PostCodeEnum;
import com.bsd.pjcloud.admin.api.dto.DeptAllListDto;
import com.bsd.pjcloud.admin.api.entity.*;
import com.bsd.pjcloud.admin.api.utils.DataUtil;
import com.bsd.pjcloud.admin.api.vo.DeptExcelVO;
@@ -413,6 +414,15 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
);
}
@Override
public List<SysDept> getInnerDept(DeptAllListDto dto) {
return baseMapper.selectList(new LambdaQueryWrapper<SysDept>()
.eq(ObjectUtil.isNotEmpty(dto.getDeptId()), SysDept::getDeptId, dto.getDeptId())
.eq(ObjectUtil.isNotEmpty(dto.getIsSyncZy()), SysDept::getIsSyncZy, dto.getIsSyncZy())
.in(ObjectUtil.isNotEmpty(dto.getDeptIds()), SysDept::getDeptId, dto.getDeptIds())
);
}
/**
* 递归查询所有子节点。
*
@@ -142,8 +142,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
BeanUtils.copyProperties(userDto, sysUser);
// 判断是否为部门管理员
PjcloudUser applyUser = SecurityUtils.getUser();
boolean isDeptAdmin=false;
if (null!=applyUser){
boolean isDeptAdmin = false;
if (null != applyUser) {
isDeptAdmin = sysRoleService.isDeptAdmin(applyUser.getId());
if (isDeptAdmin) {
List<SysRole> defaultRoles = sysRoleService.findRolesByCodes(List.of(CommonRoleConstant.DEFAULT_USER, CommonRoleConstant.AUTO_CREATE_WALLET));
@@ -272,6 +272,37 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
return list;
}
@Override
public IPage<UserVO> innerPage(Page page, UserDTO userDTO) {
IPage<UserVO> list = baseMapper.getUserVosPage(page, userDTO, null);
if (ObjectUtil.isNotEmpty(list.getRecords())) {
List<Long> userIds = list.getRecords().stream().map(UserVO::getUserId).distinct().toList();
if (ObjectUtil.isNotEmpty(userIds)) {
SysUserFaceDto faceDto = new SysUserFaceDto();
List<SysUserFaceVo> faceList = sysUserFaceMapper.groupConcatFaces(faceDto);
DataUtil.convertFacesList(list.getRecords(), CollectionUtils.convertMap(faceList, SysUserFaceVo::getUserId));
}
// 审批流程
if (userDTO.getIsFindCheckUser()) {
List<String> processInstanceIds = list.getRecords().stream().map(UserVO::getProcessId).filter(ObjectUtil::isNotEmpty).distinct().toList();
if (ObjectUtil.isNotEmpty(processInstanceIds)) {
List<TaskDto> taskList = flowUtil.queryProcessInstanceList(SecurityUtils.getUser().getId().toString(), processInstanceIds);
if (ObjectUtil.isNotEmpty(taskList)) {
Map<String, TaskDto> taskMap = CollectionUtils.convertMap(taskList, TaskDto::getProcessInstanceId);
CollectionUtils.convertList(list.getRecords(), v -> {
TaskDto task = taskMap.get(v.getProcessId());
if (ObjectUtil.isNotEmpty(task)) {
v.setIsCheckUser(true);
}
return v;
});
}
}
}
}
return list;
}
/**
* 通过ID查询用户信息
*
@@ -292,8 +323,16 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean deleteUserByIds(Long[] ids) {
// 删除 spring cache
List<SysUser> userList = baseMapper.selectBatchIds(CollUtil.toList(ids));
// 判断是否可以删除
userList.forEach(v -> {
String errorMsg = remoteWalletService.isDel(v.getUserId()).getData();
if (ObjectUtil.isNotEmpty(errorMsg)) {
throw new RuntimeException(errorMsg);
}
});
// 删除 spring cache
Cache cache = cacheManager.getCache(CacheConstants.USER_DETAILS);
for (SysUser sysUser : userList) {
cache.evict(sysUser.getUsername());
@@ -24,6 +24,7 @@
<id property="deptId" column="dept_id"/>
<result property="name" column="name"/>
<result property="hardGroupId" column="hard_group_id"/>
<result property="isSyncZy" column="is_sync_zy"/>
<result property="sortOrder" column="sort_order"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
@@ -37,6 +38,7 @@
a.name,
a.hard_group_id,
a.sort_order,
a.is_sync_zy,
a.create_by,
a.update_by,
a.create_time,
@@ -50,6 +52,9 @@
<if test="dto.deptId != null">
AND a.dept_id = #{dto.deptId}
</if>
<if test="dto.isSyncZy != null">
AND a.is_sync_zy = #{dto.isSyncZy}
</if>
<if test="dto.deptIds != null and dto.deptIds.size() != 0">
<choose>
<when test="dto.isInclude != null and dto.isInclude == true">
@@ -69,9 +74,11 @@
</sql>
<select id="allList" resultType="com.bsd.pjcloud.admin.api.entity.SysDept">
select a.dept_id,
select
a.dept_id,
a.hard_group_id,
a.sort_order,
a.is_sync_zy,
a.create_by,
a.update_by,
a.create_time,
@@ -15,6 +15,7 @@ public enum WalletBizEnum {
RECHARGE("3", "充值"),
PAYMENT("4", "支付"),
REFUND("5", "退款"),
TRANSFER_ACCOUNTS("6", "转账"),
;
private final String code;
@@ -1,4 +1,4 @@
package com.bsd.pjcloud.wallet.api.constant;
package com.bsd.pjcloud.wallet.api.constant.mch;
import cn.hutool.core.util.ObjectUtil;
import lombok.AllArgsConstructor;
@@ -11,7 +11,7 @@ import java.util.Arrays;
*/
@Getter
@AllArgsConstructor
public enum WalletRulePriceTypeEnum {
public enum WalletMchRulePriceTypeEnum {
STRIDE_LIMIT("10", "跨单位额外支付"),
EVERY_LIMIT("20", "每餐额外支付"),
;
@@ -19,7 +19,7 @@ public enum WalletRulePriceTypeEnum {
private final String code;
private final String desc;
public static WalletRulePriceTypeEnum valueOfByCode(String code) {
public static WalletMchRulePriceTypeEnum valueOfByCode(String code) {
if (ObjectUtil.isEmpty(code)) return null;
return Arrays.stream(values()).filter(v -> ObjectUtil.equals(code, v.getCode())).findFirst().get();
}
@@ -0,0 +1,30 @@
package com.bsd.pjcloud.wallet.api.constant.mch;
import cn.hutool.core.util.ObjectUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
/**
* 合作商家类型
*/
@Getter
@AllArgsConstructor
public enum WalletMchSupType {
BRAND("10", "品牌"),
MCH("20", "商户"),
;
private final String code;
private final String desc;
public static WalletMchSupType valueOfByType(String code) {
return Arrays.stream(WalletMchSupType.values())
.filter(v -> ObjectUtil.equal(v.getCode(), code))
.findFirst().get();
}
}
@@ -1,6 +1,6 @@
package com.bsd.pjcloud.wallet.api.dto;
import com.bsd.pjcloud.wallet.api.entity.MchManageEntity;
import com.bsd.pjcloud.wallet.api.entity.mch.MchManageEntity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -20,4 +20,5 @@ public class MchManageDto extends MchManageEntity {
private String type;
private Boolean parentIsNull = true;
}
@@ -0,0 +1,26 @@
package com.bsd.pjcloud.wallet.api.dto.mch;
import com.bsd.pjcloud.wallet.api.entity.mch.MchDeptEntity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class MchDeptDto extends MchDeptEntity {
private List<Long> mchIds;
private List<Long> dpetIds;
/**
* 商户名
*/
private String merchantName;
}
@@ -0,0 +1,9 @@
package com.bsd.pjcloud.wallet.api.dto.mch;
import com.bsd.pjcloud.wallet.api.entity.mch.MchRuleJoinDtoEntity;
import lombok.Data;
@Data
public class MchRuleJoinDto extends MchRuleJoinDtoEntity {
}
@@ -0,0 +1,9 @@
package com.bsd.pjcloud.wallet.api.dto.mch;
import com.bsd.pjcloud.wallet.api.entity.mch.MchRulePriceConfigEntity;
import lombok.Data;
@Data
public class MchRulePriceConfigDto extends MchRulePriceConfigEntity {
}
@@ -0,0 +1,24 @@
package com.bsd.pjcloud.wallet.api.dto.rule;
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleJoinEntity;
import jakarta.validation.constraints.NotEmpty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class WalletRuleJoinDto extends WalletRuleJoinEntity {
/**
* 部门数组
*/
@NotEmpty(message = "部门数组不能为空")
private List<@NotEmpty Long> targetDeptIdList;
}
@@ -1,8 +0,0 @@
package com.bsd.pjcloud.wallet.api.dto.rule;
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleMchConfigEntity;
import lombok.Data;
@Data
public class WalletRuleMchConfigDto extends WalletRuleMchConfigEntity {
}
@@ -1,8 +0,0 @@
package com.bsd.pjcloud.wallet.api.dto.rule;
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRulePriceConfigEntity;
import lombok.Data;
@Data
public class WalletRulePriceConfigDto extends WalletRulePriceConfigEntity {
}
@@ -0,0 +1,20 @@
package com.bsd.pjcloud.wallet.api.dto.rule;
import com.bsd.pjcloud.admin.api.vo.base.BaseIsIncludeTreeInterface;
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleTransactionEntity;
import lombok.Data;
import java.util.List;
@Data
public class WalletRuleTransactionDto extends WalletRuleTransactionEntity implements BaseIsIncludeTreeInterface {
/**
* 树状结构搜索
*/
private List<Long> deptIds;
private Boolean isInclude = false;
}
@@ -6,6 +6,7 @@ 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;
/**
@@ -22,70 +23,76 @@ import java.time.LocalDateTime;
public class WalletTypeEntity extends Model<WalletTypeEntity> {
/**
* 主键
*/
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description="主键")
@Schema(description = "主键")
private Long id;
/**
* 钱包名
*/
@Schema(description="钱包名")
/**
* 钱包名
*/
@Schema(description = "钱包名")
private String name;
/**
* 钱包图标
*/
@Schema(description="钱包图标")
/**
* 钱包图标
*/
@Schema(description = "钱包图标")
private String icon;
/**
* 饭卡code
*/
@Schema(description="饭卡code")
/**
* 饭卡code
*/
@Schema(description = "饭卡code")
private String uniqueCode;
/**
* 创建人
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description="创建人")
/**
* 是否启用钱包转账规则
*/
@Schema(description = "是否启用钱包转账规则")
private String isRule;
/**
* 创建人
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description = "创建人")
private String createBy;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description="创建时间")
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description = "创建时间")
private LocalDateTime createTime;
/**
* 修改人
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description="修改人")
/**
* 修改人
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description = "修改人")
private String updateBy;
/**
* 修改时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description="修改时间")
/**
* 修改时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description = "修改时间")
private LocalDateTime updateTime;
/**
* 删除标记
*/
/**
* 删除标记
*/
@TableLogic
@TableField(fill = FieldFill.INSERT)
@Schema(description="删除标记")
@TableField(fill = FieldFill.INSERT)
@Schema(description = "删除标记")
private String delFlag;
/**
* 租户ID
*/
@Schema(description="租户ID")
/**
* 租户ID
*/
@Schema(description = "租户ID")
private Long tenantId;
}
@@ -0,0 +1,83 @@
package com.bsd.pjcloud.wallet.api.entity.mch;
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;
/**
* 用户部门商户关系表
*/
@Data
@TenantTable
@TableName("mch_dept")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "部门商户关系表")
public class MchDeptEntity extends Model<MchDeptEntity> {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description = "主键")
private Long id;
/**
* 商户id
*/
@Schema(description = "商户id")
private Long mchId;
/**
* 部门id
*/
@Schema(description = "部门id")
private Long deptId;
/**
* 创建人
*/
@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;
}
@@ -1,4 +1,4 @@
package com.bsd.pjcloud.wallet.api.entity;
package com.bsd.pjcloud.wallet.api.entity.mch;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
@@ -111,19 +111,18 @@ public class MchManageEntity extends Model<MchManageEntity> {
@Schema(description = "是否同步到正元")
private String isSyncZy;
/**
* 创建人
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description = "创建人")
private String createBy;
/**
* 排序
*/
@Schema(description = "排序")
private Long sort;
/**
* 创建人
*/
@Schema(description = "超市类型")
private String supType;
/**
* 优惠价格(没实际作用)
*/
@@ -142,6 +141,13 @@ public class MchManageEntity extends Model<MchManageEntity> {
@Schema(description = "分店数量")
private Long mchCount;
/**
* 创建人
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description = "创建人")
private String createBy;
/**
* 创建时间
*/
@@ -1,4 +1,4 @@
package com.bsd.pjcloud.wallet.api.entity.rule;
package com.bsd.pjcloud.wallet.api.entity.mch;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
@@ -9,18 +9,12 @@ import com.bsd.pjcloud.common.core.util.TenantTable;
import java.time.LocalDateTime;
/**
* 商户规格配置表
*
* @author pjcloud
* @date 2025-03-26 11:14:39
*/
@Data
@TenantTable
@TableName("wallet_rule_mch_config")
@TableName("mch_rule_join")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "商户规格配置表")
public class WalletRuleMchConfigEntity extends Model<WalletRuleMchConfigEntity> {
public class MchRuleJoinDtoEntity extends Model<MchRuleJoinDtoEntity> {
/**
@@ -45,7 +39,7 @@ public class WalletRuleMchConfigEntity extends Model<WalletRuleMchConfigEntity>
/**
* 目标部门id
*/
private Long tragetDeptId;
private Long targetDeptId;
/**
* 规则配置id
@@ -53,6 +47,12 @@ public class WalletRuleMchConfigEntity extends Model<WalletRuleMchConfigEntity>
@Schema(description = "规则配置id")
private Long rulePriceConfigId;
/**
* 是否启用
*/
@Schema(description = "是否启用")
private String status;
/**
* 创建人
*/
@@ -1,4 +1,4 @@
package com.bsd.pjcloud.wallet.api.entity.rule;
package com.bsd.pjcloud.wallet.api.entity.mch;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
@@ -9,14 +9,12 @@ import com.bsd.pjcloud.common.core.util.TenantTable;
import java.time.LocalDateTime;
@Data
@TenantTable
@TableName("wallet_rule_price_config")
@TableName("mch_rule_price_config")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "钱包规则")
public class WalletRulePriceConfigEntity extends Model<WalletRulePriceConfigEntity> {
public class MchRulePriceConfigEntity extends Model<MchRulePriceConfigEntity> {
/**
* 主键
@@ -27,6 +25,7 @@ public class WalletRulePriceConfigEntity extends Model<WalletRulePriceConfigEnti
/**
* 规则类型
* @see
*/
@Schema(description = "规则类型")
private String rulePriceType;
@@ -0,0 +1,101 @@
package com.bsd.pjcloud.wallet.api.entity.rule;
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;
/**
* 钱包规则配置
*/
@Data
@TenantTable
@TableName("wallet_rule_join")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "钱包规则配置")
public class WalletRuleJoinEntity extends Model<WalletRuleJoinEntity> {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description = "主键")
private Long id;
/**
* 源钱包类型id
*/
@Schema(description = "源钱包类型id")
private Long sourceWalletTypeId;
/**
* 目标钱包类型id
*/
@Schema(description = "目标钱包类型id")
private Long targetWalletTypeId;
/**
* 目标部门id
*/
@Schema(description = "目标部门id")
private Long targetDeptId;
/**
* 钱包转换百分比
*/
@Schema(description = "钱包转换百分比")
private Integer balanceMultiple;
/**
* 是否启用
*/
@Schema(description = "是否启用")
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;
}
@@ -0,0 +1,119 @@
package com.bsd.pjcloud.wallet.api.entity.rule;
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;
/**
* 钱包转账记录
*/
@Data
@TenantTable
@TableName("wallet_rule_transaction")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "钱包转账记录")
public class WalletRuleTransactionEntity extends Model<WalletRuleTransactionEntity> {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description = "主键")
private Long id;
/**
* 源钱包id
*/
@Schema(description = "源钱包id")
private Long sourceWalletId;
/**
* 目标钱包id
*/
@Schema(description = "目标钱包id")
private Long targetWalletId;
/**
* 源钱包余额
*/
@Schema(description = "源钱包余额")
private Integer sourceWalletBalance;
/**
* 目标钱包余额
*/
@Schema(description = "目标钱包余额")
private Integer targetWalletBalance;
/**
* 转换金额
*/
@Schema(description = "转换金额")
private Integer balance;
/**
* 转换后的金额
*/
@Schema(description = "转换后的金额")
private Integer afterBalance;
/**
* 钱包转换百分比
*/
@Schema(description = "钱包转换百分比")
private Integer balanceMultiple;
/**
* 是否退回
*/
@Schema(description = "是否退回")
private String isRefund;
/**
* 创建人
*/
@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;
}
@@ -49,4 +49,7 @@ public interface RemoteWalletService {
@GetMapping("/wallet-manage/dept-change")
R<Boolean> deptChange(@RequestParam Long deptId, @RequestParam Boolean isDel);
@GetMapping("/wallet-manage/is-del")
R<String> isDel(@RequestParam Long userId);
}
@@ -1,10 +1,11 @@
package com.bsd.pjcloud.wallet.api.vo;
import com.bsd.pjcloud.admin.api.vo.base.BaseDeptInterface;
import com.bsd.pjcloud.wallet.api.entity.MchManageEntity;
import com.bsd.pjcloud.wallet.api.entity.mch.MchManageEntity;
import com.bsd.pjcloud.wallet.api.vo.base.BaseWalletTypeInterface;
import lombok.Data;
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
import java.util.List;
@Data
public class MchManageVo extends MchManageEntity implements BaseDeptInterface, BaseWalletTypeInterface {
@@ -19,4 +20,6 @@ public class MchManageVo extends MchManageEntity implements BaseDeptInterface, B
private String walletTypeIcon;
private List<MchManageVo> children;
}
@@ -0,0 +1,25 @@
package com.bsd.pjcloud.wallet.api.vo.mch;
import com.bsd.pjcloud.admin.api.vo.base.BaseDeptInterface;
import com.bsd.pjcloud.wallet.api.entity.mch.MchDeptEntity;
import com.bsd.pjcloud.wallet.api.vo.base.BaseMchInterface;
import lombok.Data;
@Data
public class MchDeptVo extends MchDeptEntity implements BaseMchInterface, BaseDeptInterface {
/**
* 商户相关
*/
private Long merchantId;
private String merchantName;
private String logoPic;
/**
* 部门相关
*/
private String deptName;
}
@@ -1,10 +1,10 @@
package com.bsd.pjcloud.wallet.api.vo.rule;
package com.bsd.pjcloud.wallet.api.vo.mch;
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleMchConfigEntity;
import com.bsd.pjcloud.wallet.api.entity.mch.MchRuleJoinDtoEntity;
import lombok.Data;
@Data
public class WalletRuleMchConfigVo extends WalletRuleMchConfigEntity {
public class MchRuleJoinDtoVo extends MchRuleJoinDtoEntity {
/**
* 钱包规则id
@@ -26,4 +26,14 @@ public class WalletRuleMchConfigVo extends WalletRuleMchConfigEntity {
*/
private Long multiple;
/**
* 源商户名
*/
private String sourceMchName;
/**
* 目标商户名
*/
private String targetMchName;
}
@@ -0,0 +1,8 @@
package com.bsd.pjcloud.wallet.api.vo.mch;
import com.bsd.pjcloud.wallet.api.entity.mch.MchRulePriceConfigEntity;
import lombok.Data;
@Data
public class MchRulePriceConfigVo extends MchRulePriceConfigEntity {
}
@@ -0,0 +1,33 @@
package com.bsd.pjcloud.wallet.api.vo.rule;
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleJoinEntity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class WalletRuleJoinVo extends WalletRuleJoinEntity {
/**
* 源钱包类型
*/
private String sourceName;
private String sourceUniqueCode;
private String sourceIcon;
/**
* 目标钱包类型
*/
private String targetName;
private String targetUniqueCode;
private String targetIcon;
}
@@ -1,8 +0,0 @@
package com.bsd.pjcloud.wallet.api.vo.rule;
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRulePriceConfigEntity;
import lombok.Data;
@Data
public class WalletRulePriceConfigVo extends WalletRulePriceConfigEntity {
}
@@ -0,0 +1,30 @@
package com.bsd.pjcloud.wallet.api.vo.rule;
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleTransactionEntity;
import lombok.Data;
@Data
public class WalletRuleTransactionVo extends WalletRuleTransactionEntity {
/**
* 用户相关
*/
private Long userId;
private Long deptId;
/**
* 源钱包相关
*/
private String sourceWalletTypeName;
private String sourceWalletTypeCode;
/**
* 目标钱包相关
*/
private String targetWalletTypeName;
private String targetWalletTypeCode;
}
@@ -6,18 +6,14 @@ 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.common.core.util.BeanUtils;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.log.annotation.SysLog;
import com.bsd.pjcloud.common.security.annotation.Inner;
import com.bsd.pjcloud.common.security.service.PjcloudUser;
import com.bsd.pjcloud.common.security.util.SecurityUtils;
import com.bsd.pjcloud.flow.task.dto.ProcessNodeRecordAssignUserParamDto;
import com.bsd.pjcloud.wallet.api.dto.WalletActiveDto;
import com.bsd.pjcloud.wallet.api.dto.WalletFreezeDto;
import com.bsd.pjcloud.wallet.api.entity.MchManageEntity;
import com.bsd.pjcloud.wallet.api.entity.WalletFreezeEntity;
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
import com.bsd.pjcloud.wallet.service.WalletFreezeService;
import org.springframework.security.access.prepost.PreAuthorize;
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
@@ -126,6 +126,11 @@ public class WalletManageController {
return R.ok(true);
}
@GetMapping("/is-del")
public R<String> isDel(@RequestParam Long userId) {
return R.ok(walletManageService.isDel(userId));
}
/* ************************************* end 远程调用 end ************************************* */
@@ -0,0 +1,91 @@
package com.bsd.pjcloud.wallet.controller.mch;
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.data.datascope.DataScope;
import com.bsd.pjcloud.common.data.datascope.DataScopeFuncEnum;
import com.bsd.pjcloud.common.log.annotation.SysLog;
import com.bsd.pjcloud.wallet.api.dto.mch.MchDeptDto;
import com.bsd.pjcloud.wallet.api.entity.mch.MchDeptEntity;
import com.bsd.pjcloud.wallet.service.MchDeptService;
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;
/**
* 用户部门商户关系表
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/mch-dept")
@Tag(description = "mch-dept", name = "用户部门商户关系表管理")
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class MchDeptController {
private final MchDeptService mchDeptUserService;
@Operation(summary = "同步全部", description = "分页查询")
@GetMapping("/sync-all")
public R syncAll() {
mchDeptUserService.syncAll(List.of());
return R.ok();
}
@Operation(summary = "分页复杂查询", description = "分页复杂查询")
@GetMapping("/page-join")
@PreAuthorize("@pms.hasPermission('wallet_mchDeptUser_view')")
public R pageJoin(@ParameterObject Page page, @ParameterObject MchDeptDto dto) {
DataScope dataScope = DataScope.of().func(DataScopeFuncEnum.ALL);
return R.ok(mchDeptUserService.scopeJoinPage(page, dto, dataScope));
}
@Operation(summary = "通过id查询", description = "通过id查询")
@GetMapping("/{id}")
@PreAuthorize("@pms.hasPermission('wallet_mchDeptUser_view')")
public R getById(@PathVariable("id") Long id) {
return R.ok(mchDeptUserService.getById(id));
}
@Operation(summary = "新增用户部门商户关系表", description = "新增用户部门商户关系表")
@SysLog("新增用户部门商户关系表")
@PostMapping
@PreAuthorize("@pms.hasPermission('wallet_mchDeptUser_add')")
public R save(@RequestBody MchDeptEntity mchDeptUser) {
return R.ok(mchDeptUserService.save(mchDeptUser));
}
@Operation(summary = "修改用户部门商户关系表", description = "修改用户部门商户关系表")
@SysLog("修改用户部门商户关系表")
@PutMapping
@PreAuthorize("@pms.hasPermission('wallet_mchDeptUser_edit')")
public R updateById(@RequestBody MchDeptEntity mchDeptUser) {
return R.ok(mchDeptUserService.updateById(mchDeptUser));
}
@Operation(summary = "通过id删除用户部门商户关系表", description = "通过id删除用户部门商户关系表")
@SysLog("通过id删除用户部门商户关系表")
@DeleteMapping
@PreAuthorize("@pms.hasPermission('wallet_mchDeptUser_del')")
public R removeById(@RequestBody Long[] ids) {
return R.ok(mchDeptUserService.removeBatchByIds(CollUtil.toList(ids)));
}
@ResponseExcel
@GetMapping("/export")
@PreAuthorize("@pms.hasPermission('wallet_mchDeptUser_export')")
public List<MchDeptEntity> export(MchDeptEntity mchDeptUser, Long[] ids) {
return mchDeptUserService.list(Wrappers.lambdaQuery(mchDeptUser).in(ArrayUtil.isNotEmpty(ids), MchDeptEntity::getId, ids));
}
}
@@ -1,4 +1,4 @@
package com.bsd.pjcloud.wallet.controller;
package com.bsd.pjcloud.wallet.controller.mch;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.collection.CollUtil;
@@ -12,7 +12,7 @@ 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.dto.MchManageDto;
import com.bsd.pjcloud.wallet.api.entity.MchManageEntity;
import com.bsd.pjcloud.wallet.api.entity.mch.MchManageEntity;
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
import com.bsd.pjcloud.wallet.service.MchManageService;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -101,6 +101,16 @@ public class MchManageController {
return R.ok(mchManageService.pageJoin(page, dto));
}
@Operation(summary = "app查询合作商家的分店", description = "app查询合作商家的分店")
@GetMapping("/app/children-page-join")
@Inner(value = false)
public R<Page<MchManageVo>> appParentPageJoin(@ParameterObject Page page, @ParameterObject MchManageDto dto) {
dto.setVisibleMobile(YesNoEnum.YES.getCode());
dto.setTypes(MerchantTypeEnum.SUPERMARKET.getType());
dto.setParentIsNull(false);
return R.ok(mchManageService.pageJoin(page, dto));
}
@Operation(summary = "app查询店铺详情", description = "app查询店铺详情")
@GetMapping("/app/detail")
public R<MchManageVo> appPageJoin(@RequestParam Long id) {
@@ -119,7 +129,7 @@ public class MchManageController {
@Operation(summary = "分页查询", description = "分页查询")
@GetMapping("/page")
@PreAuthorize("@pms.hasPermission('wallet_mchManage_view')")
public R getMchManagePage(@ParameterObject Page page, @ParameterObject MchManageEntity mchManage) {
public R<Page<MchManageVo>> getMchManagePage(@ParameterObject Page page, @ParameterObject MchManageEntity mchManage) {
LambdaQueryWrapper<MchManageEntity> wrapper = Wrappers.lambdaQuery();
return R.ok(mchManageService.page(page, wrapper));
}
@@ -127,10 +137,17 @@ public class MchManageController {
@Operation(summary = "分页复杂查询", description = "分页查询")
@GetMapping("/page-join")
@PreAuthorize("@pms.hasPermission('wallet_mchManage_view')")
public R getMchManagePageJoin(@ParameterObject Page page, @ParameterObject MchManageDto dto) {
public R<Page<MchManageVo>> getMchManagePageJoin(@ParameterObject Page page, @ParameterObject MchManageDto dto) {
return R.ok(mchManageService.scopePageList(page, dto));
}
@Operation(summary = "分页级联", description = "分页级联")
@GetMapping("/cascade-join")
@PreAuthorize("@pms.hasPermission('wallet_mchManage_view')")
public R<Page<MchManageVo>> cascadeJoin(@ParameterObject Page page, @ParameterObject MchManageDto dto) {
return R.ok(mchManageService.cascadeJoin(page, dto));
}
@Operation(summary = "分页不要权限下拉", description = "分页不要权限下拉")
@GetMapping("/select")
public R getSelect(@ParameterObject Page page, @ParameterObject MchManageDto dto) {
@@ -1,4 +1,4 @@
package com.bsd.pjcloud.wallet.controller.rule;
package com.bsd.pjcloud.wallet.controller.mch;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.collection.CollUtil;
@@ -8,9 +8,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.common.log.annotation.SysLog;
import com.bsd.pjcloud.wallet.api.dto.rule.WalletRuleMchConfigDto;
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleMchConfigEntity;
import com.bsd.pjcloud.wallet.service.WalletRuleMchConfigService;
import com.bsd.pjcloud.wallet.api.dto.mch.MchRuleJoinDto;
import com.bsd.pjcloud.wallet.api.entity.mch.MchRuleJoinDtoEntity;
import com.bsd.pjcloud.wallet.service.MchRuleJoinControllerService;
import org.springframework.security.access.prepost.PreAuthorize;
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
@@ -26,75 +26,71 @@ import java.util.List;
@RestController
@RequiredArgsConstructor
@RequestMapping("/wallet-rule-mch-config")
@Tag(description = "wallet-rule-mch-config", name = "商户规格配置表管理")
@RequestMapping("/mch-rule-join")
@Tag(description = "mch-rule-join", name = "商户规格配置表管理")
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class WalletRuleMchConfigController {
public class MchRuleJoinController {
private final WalletRuleMchConfigService walletRuleMchConfigService;
private final MchRuleJoinControllerService mchRuleJoinControllerService;
@Operation(summary = "分页查询", description = "分页查询")
@GetMapping("/page")
@PreAuthorize("@pms.hasPermission('dzc_walletRuleMchConfig_view')")
public R getWalletRuleMchConfigPage(@ParameterObject Page page, @ParameterObject WalletRuleMchConfigEntity walletRuleMchConfig) {
LambdaQueryWrapper<WalletRuleMchConfigEntity> wrapper = Wrappers.lambdaQuery();
return R.ok(walletRuleMchConfigService.page(page, wrapper));
public R getWalletRuleMchConfigPage(@ParameterObject Page page, @ParameterObject MchRuleJoinDtoEntity walletRuleMchConfig) {
LambdaQueryWrapper<MchRuleJoinDtoEntity> wrapper = Wrappers.lambdaQuery();
return R.ok(mchRuleJoinControllerService.page(page, wrapper));
}
@Operation(summary = "分页复杂查询", description = "分页复杂查询")
@GetMapping("/page-join")
@PreAuthorize("@pms.hasPermission('dzc_walletRuleMchConfig_view')")
public R pageJoin(@ParameterObject Page page, @ParameterObject WalletRuleMchConfigDto dto) {
return R.ok(walletRuleMchConfigService.pageScopeList(page, dto, DataScope.of()));
public R pageJoin(@ParameterObject Page page, @ParameterObject MchRuleJoinDto dto) {
return R.ok(mchRuleJoinControllerService.pageScopeList(page, dto, DataScope.of()));
}
@Operation(summary = "通过id查询", description = "通过id查询")
@GetMapping("/{id}")
@PreAuthorize("@pms.hasPermission('dzc_walletRuleMchConfig_view')")
public R getById(@PathVariable("id") Long id) {
return R.ok(walletRuleMchConfigService.getById(id));
return R.ok(mchRuleJoinControllerService.getById(id));
}
@Operation(summary = "通过id查询", description = "通过id查询")
@GetMapping("join-detail/{id}")
@PreAuthorize("@pms.hasPermission('dzc_walletRuleMchConfig_view')")
public R joinDetail(@PathVariable("id") Long id) {
return R.ok(mchRuleJoinControllerService.joinDetail(id));
}
/**
* 新增商户规格配置表
*
* @param walletRuleMchConfig 商户规格配置表
* @return R
*/
@Operation(summary = "新增商户规格配置表", description = "新增商户规格配置表")
@SysLog("新增商户规格配置表")
@PostMapping
@PreAuthorize("@pms.hasPermission('dzc_walletRuleMchConfig_add')")
public R save(@RequestBody WalletRuleMchConfigEntity walletRuleMchConfig) {
return R.ok(walletRuleMchConfigService.save(walletRuleMchConfig));
public R save(@RequestBody MchRuleJoinDtoEntity dto) {
return R.ok(mchRuleJoinControllerService.create(dto));
}
/**
* 修改商户规格配置表
*
* @param walletRuleMchConfig 商户规格配置表
* @return R
*/
@Operation(summary = "修改商户规格配置表", description = "修改商户规格配置表")
@SysLog("修改商户规格配置表")
@PutMapping
@PreAuthorize("@pms.hasPermission('dzc_walletRuleMchConfig_edit')")
public R updateById(@RequestBody WalletRuleMchConfigEntity walletRuleMchConfig) {
return R.ok(walletRuleMchConfigService.updateById(walletRuleMchConfig));
public R updateById(@RequestBody MchRuleJoinDtoEntity dto) {
return R.ok(mchRuleJoinControllerService.edit(dto));
}
@Operation(summary = "通过id删除商户规格配置表", description = "通过id删除商户规格配置表")
@SysLog("通过id删除商户规格配置表")
@DeleteMapping
@PreAuthorize("@pms.hasPermission('dzc_walletRuleMchConfig_del')")
public R removeById(@RequestBody Long ids) {
return R.ok(walletRuleMchConfigService.removeBatchByIds(CollUtil.toList(ids)));
public R removeById(@RequestBody Long[] ids) {
mchRuleJoinControllerService.delByIds(CollUtil.toList(ids));
return R.ok();
}
@ResponseExcel
@GetMapping("/export")
@PreAuthorize("@pms.hasPermission('dzc_walletRuleMchConfig_export')")
public List<WalletRuleMchConfigEntity> export(WalletRuleMchConfigEntity walletRuleMchConfig, Long[] ids) {
return walletRuleMchConfigService.list(Wrappers.lambdaQuery(walletRuleMchConfig).in(ArrayUtil.isNotEmpty(ids), WalletRuleMchConfigEntity::getId, ids));
public List<MchRuleJoinDtoEntity> export(MchRuleJoinDtoEntity walletRuleMchConfig, Long[] ids) {
return mchRuleJoinControllerService.list(Wrappers.lambdaQuery(walletRuleMchConfig).in(ArrayUtil.isNotEmpty(ids), MchRuleJoinDtoEntity::getId, ids));
}
}
@@ -1,4 +1,4 @@
package com.bsd.pjcloud.wallet.controller.rule;
package com.bsd.pjcloud.wallet.controller.mch;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.collection.CollUtil;
@@ -6,9 +6,10 @@ 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.data.datascope.DataScope;
import com.bsd.pjcloud.common.log.annotation.SysLog;
import com.bsd.pjcloud.wallet.api.dto.rule.WalletRulePriceConfigDto;
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRulePriceConfigEntity;
import com.bsd.pjcloud.wallet.api.dto.mch.MchRulePriceConfigDto;
import com.bsd.pjcloud.wallet.api.entity.mch.MchRulePriceConfigEntity;
import com.bsd.pjcloud.wallet.service.WalletRulePriceConfigService;
import org.springframework.security.access.prepost.PreAuthorize;
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
@@ -24,24 +25,33 @@ import java.util.List;
@RestController
@RequiredArgsConstructor
@RequestMapping("/wallet-rule-price-config")
@Tag(description = "wallet-rule-price-config", name = "钱包规则管理")
@RequestMapping("/mch-rule-price-config")
@Tag(description = "mch-rule-price-config", name = "钱包规则管理")
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class WalletRulePriceConfigController {
public class MchRulePriceConfigController {
private final WalletRulePriceConfigService walletRulePriceConfigService;
@Operation(summary = "分页查询", description = "分页查询")
@GetMapping("/page")
@PreAuthorize("@pms.hasPermission('wallet_walletRulePriceConfig_view')")
public R getWalletRulePriceConfigPage(@ParameterObject Page page, @ParameterObject WalletRulePriceConfigEntity walletRulePriceConfig) {
LambdaQueryWrapper<WalletRulePriceConfigEntity> wrapper = Wrappers.lambdaQuery();
public R getWalletRulePriceConfigPage(@ParameterObject Page page, @ParameterObject MchRulePriceConfigEntity walletRulePriceConfig) {
LambdaQueryWrapper<MchRulePriceConfigEntity> wrapper = Wrappers.lambdaQuery();
return R.ok(walletRulePriceConfigService.page(page, wrapper));
}
@Operation(summary = "分页下拉查询", description = "分页下拉查询")
@GetMapping("/page-select")
public R pageSelect(@ParameterObject Page page, @ParameterObject MchRulePriceConfigDto dto) {
DataScope dataScope = null;
return R.ok(walletRulePriceConfigService.scopePageList(page, dto, dataScope));
}
@Operation(summary = "通过id查询", description = "通过id查询")
@GetMapping("/{id}")
@PreAuthorize("@pms.hasPermission('wallet_walletRulePriceConfig_view')")
public R getById(@PathVariable("id") Long id) {
return R.ok(walletRulePriceConfigService.getById(id));
}
@@ -50,7 +60,7 @@ public class WalletRulePriceConfigController {
@SysLog("新增钱包规则")
@PostMapping
@PreAuthorize("@pms.hasPermission('wallet_walletRulePriceConfig_add')")
public R save(@RequestBody WalletRulePriceConfigDto dto) {
public R save(@RequestBody MchRulePriceConfigDto dto) {
return R.ok(walletRulePriceConfigService.create(dto));
}
@@ -58,7 +68,7 @@ public class WalletRulePriceConfigController {
@SysLog("修改钱包规则")
@PutMapping
@PreAuthorize("@pms.hasPermission('wallet_walletRulePriceConfig_edit')")
public R updateById(@RequestBody WalletRulePriceConfigDto dto) {
public R updateById(@RequestBody MchRulePriceConfigDto dto) {
return R.ok(walletRulePriceConfigService.edit(dto));
}
@@ -74,7 +84,7 @@ public class WalletRulePriceConfigController {
@ResponseExcel
@GetMapping("/export")
@PreAuthorize("@pms.hasPermission('wallet_walletRulePriceConfig_export')")
public List<WalletRulePriceConfigEntity> export(WalletRulePriceConfigEntity walletRulePriceConfig, Long[] ids) {
return walletRulePriceConfigService.list(Wrappers.lambdaQuery(walletRulePriceConfig).in(ArrayUtil.isNotEmpty(ids), WalletRulePriceConfigEntity::getId, ids));
public List<MchRulePriceConfigEntity> export(MchRulePriceConfigEntity walletRulePriceConfig, Long[] ids) {
return walletRulePriceConfigService.list(Wrappers.lambdaQuery(walletRulePriceConfig).in(ArrayUtil.isNotEmpty(ids), MchRulePriceConfigEntity::getId, ids));
}
}
@@ -0,0 +1,99 @@
package com.bsd.pjcloud.wallet.controller.rule;
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.data.datascope.DataScope;
import com.bsd.pjcloud.common.log.annotation.SysLog;
import com.bsd.pjcloud.wallet.api.dto.rule.WalletRuleJoinDto;
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleJoinEntity;
import com.bsd.pjcloud.wallet.service.WalletRuleJoinService;
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.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 钱包规则配置
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/wallet-rule-join")
@Tag(description = "wallet-rule-join", name = "钱包规则配置管理")
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class WalletRuleJoinController {
private final WalletRuleJoinService walletRuleJoinService;
@Operation(summary = "分页查询", description = "分页查询")
@GetMapping("/page")
// @PreAuthorize("@pms.hasPermission('wallet_walletRuleJoin_view')")
public R getWalletRuleJoinPage(@ParameterObject Page page, @ParameterObject WalletRuleJoinEntity walletRuleJoin) {
LambdaQueryWrapper<WalletRuleJoinEntity> wrapper = Wrappers.lambdaQuery();
return R.ok(walletRuleJoinService.page(page, wrapper));
}
@Operation(summary = "分页复杂查询", description = "分页复杂查询")
@GetMapping("/page-join")
// @PreAuthorize("@pms.hasPermission('wallet_walletRuleJoin_view')")
public R pageJoin(@ParameterObject Page page, @ParameterObject WalletRuleJoinDto dto) {
DataScope dataScope = null;
return R.ok(walletRuleJoinService.scopeJoinPage(page, dto, dataScope));
}
@Operation(summary = "通过id查询", description = "通过id查询")
@GetMapping("/{id}")
// @PreAuthorize("@pms.hasPermission('wallet_walletRuleJoin_view')")
public R getById(@PathVariable("id") Long id) {
return R.ok(walletRuleJoinService.getById(id));
}
@Operation(summary = "通过id查询", description = "通过id查询")
@GetMapping("join-detail/{id}")
@PreAuthorize("@pms.hasPermission('dzc_walletRuleMchConfig_view')")
public R joinDetail(@PathVariable("id") Long id) {
return R.ok(walletRuleJoinService.joinDetail(id));
}
@Operation(summary = "新增钱包规则配置", description = "新增钱包规则配置")
@SysLog("新增钱包规则配置")
@PostMapping
// @PreAuthorize("@pms.hasPermission('wallet_walletRuleJoin_add')")
public R save(@RequestBody WalletRuleJoinDto dto) {
return R.ok(walletRuleJoinService.create(dto));
}
@Operation(summary = "修改钱包规则配置", description = "修改钱包规则配置")
@SysLog("修改钱包规则配置")
@PutMapping
// @PreAuthorize("@pms.hasPermission('wallet_walletRuleJoin_edit')")
public R updateById(@RequestBody WalletRuleJoinEntity walletRuleJoin) {
return R.ok(walletRuleJoinService.edit(walletRuleJoin));
}
@Operation(summary = "通过id删除钱包规则配置", description = "通过id删除钱包规则配置")
@SysLog("通过id删除钱包规则配置")
@DeleteMapping
// @PreAuthorize("@pms.hasPermission('wallet_walletRuleJoin_del')")
public R removeById(@RequestBody Long[] ids) {
walletRuleJoinService.delByIds(CollUtil.toList(ids));
return R.ok();
}
@ResponseExcel
@GetMapping("/export")
// @PreAuthorize("@pms.hasPermission('wallet_walletRuleJoin_export')")
public List<WalletRuleJoinEntity> export(WalletRuleJoinEntity walletRuleJoin, Long[] ids) {
return walletRuleJoinService.list(Wrappers.lambdaQuery(walletRuleJoin).in(ArrayUtil.isNotEmpty(ids), WalletRuleJoinEntity::getId, ids));
}
}
@@ -0,0 +1,93 @@
package com.bsd.pjcloud.wallet.controller.rule;
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.data.datascope.DataScope;
import com.bsd.pjcloud.common.data.datascope.DataScopeFuncEnum;
import com.bsd.pjcloud.common.log.annotation.SysLog;
import com.bsd.pjcloud.wallet.api.dto.rule.WalletRuleTransactionDto;
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleTransactionEntity;
import com.bsd.pjcloud.wallet.service.WalletRuleTransactionService;
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;
/**
* 钱包转账记录
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/wallet-rule-transaction")
@Tag(description = "wallet-rule-transaction", name = "钱包转账记录管理")
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class WalletRuleTransactionController {
private final WalletRuleTransactionService walletRuleTransactionService;
@Operation(summary = "分页查询", description = "分页查询")
@GetMapping("/page")
@PreAuthorize("@pms.hasPermission('wallet_walletRuleTransaction_view')")
public R getWalletRuleTransactionPage(@ParameterObject Page page, @ParameterObject WalletRuleTransactionEntity walletRuleTransaction) {
LambdaQueryWrapper<WalletRuleTransactionEntity> wrapper = Wrappers.lambdaQuery();
return R.ok(walletRuleTransactionService.page(page, wrapper));
}
@Operation(summary = "分页复杂查询", description = "分页复杂查询")
@GetMapping("/page-join")
@PreAuthorize("@pms.hasPermission('wallet_walletRuleTransaction_view')")
public R pageJoin(@ParameterObject Page page, @ParameterObject WalletRuleTransactionDto dto) {
DataScope dataScope = DataScope.of().func(DataScopeFuncEnum.ALL);
return R.ok(walletRuleTransactionService.scopePageList(page, dto, dataScope));
}
@Operation(summary = "通过id查询", description = "通过id查询")
@GetMapping("/{id}")
@PreAuthorize("@pms.hasPermission('wallet_walletRuleTransaction_view')")
public R getById(@PathVariable("id") Long id) {
return R.ok(walletRuleTransactionService.getById(id));
}
@Operation(summary = "新增钱包转账记录", description = "新增钱包转账记录")
@SysLog("新增钱包转账记录")
@PostMapping
@PreAuthorize("@pms.hasPermission('wallet_walletRuleTransaction_add')")
public R save(@RequestBody WalletRuleTransactionEntity walletRuleTransaction) {
return R.ok(walletRuleTransactionService.save(walletRuleTransaction));
}
@Operation(summary = "修改钱包转账记录", description = "修改钱包转账记录")
@SysLog("修改钱包转账记录")
@PutMapping
@PreAuthorize("@pms.hasPermission('wallet_walletRuleTransaction_edit')")
public R updateById(@RequestBody WalletRuleTransactionEntity walletRuleTransaction) {
return R.ok(walletRuleTransactionService.updateById(walletRuleTransaction));
}
@Operation(summary = "通过id删除钱包转账记录", description = "通过id删除钱包转账记录")
@SysLog("通过id删除钱包转账记录")
@DeleteMapping
@PreAuthorize("@pms.hasPermission('wallet_walletRuleTransaction_del')")
public R removeById(@RequestBody Long[] ids) {
return R.ok(walletRuleTransactionService.removeBatchByIds(CollUtil.toList(ids)));
}
@ResponseExcel
@GetMapping("/export")
@PreAuthorize("@pms.hasPermission('wallet_walletRuleTransaction_export')")
public List<WalletRuleTransactionEntity> export(WalletRuleTransactionEntity walletRuleTransaction, Long[] ids) {
return walletRuleTransactionService.list(Wrappers.lambdaQuery(walletRuleTransaction).in(ArrayUtil.isNotEmpty(ids), WalletRuleTransactionEntity::getId, ids));
}
}
@@ -13,6 +13,8 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequiredArgsConstructor
@RequestMapping("/mch-third-zy")
@@ -47,7 +49,7 @@ public class WalletThirdZyController {
@GetMapping("/sync-all-user")
@Operation(summary = "同步全部用户")
public R<MchManageVo> syncAllUser() {
walletThirdZyService.syncAllUser(null);
walletThirdZyService.syncAllUser(List.of());
return R.ok();
}
@@ -8,7 +8,7 @@ import com.bsd.pjcloud.common.core.util.BeanUtils;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
import com.bsd.pjcloud.wallet.api.dto.MchManageDto;
import com.bsd.pjcloud.wallet.api.entity.MchManageEntity;
import com.bsd.pjcloud.wallet.api.entity.mch.MchManageEntity;
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
import com.github.yulichang.query.MPJLambdaQueryWrapper;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
@@ -24,6 +24,8 @@ public interface MchManageMapper extends PjcloudBaseMapper<MchManageEntity> {
MPJLambdaQueryWrapper<MchManageEntity> wrapper = new MPJLambdaQueryWrapper<MchManageEntity>()
.selectAll(MchManageEntity.class)
.eqIfExists(MchManageEntity::getVisibleMobile, dto.getVisibleMobile())
.eqIfExists(MchManageEntity::getParentId, dto.getParentId())
.eq(dto.getParentIsNull(), MchManageEntity::getParentId, -1L)
.likeIfExists(MchManageEntity::getName, dto.getName())
.in(ObjectUtil.isNotEmpty(dto.getDeptIds()), MchManageEntity::getDeptId, dto.getDeptIds())
.apply(ObjectUtil.isNotEmpty(dto.getType()), "FIND_IN_SET({0}, types)", dto.getType())
@@ -46,6 +48,7 @@ public interface MchManageMapper extends PjcloudBaseMapper<MchManageEntity> {
.eq(ObjectUtil.isNotEmpty(dto.getIsSyncZy()), MchManageEntity::getIsSyncZy, dto.getIsSyncZy())
.eq(ObjectUtil.isNotEmpty(dto.getVisibleMobile()), MchManageEntity::getVisibleMobile, dto.getVisibleMobile())
.eq(ObjectUtil.isNotEmpty(dto.getId()), MchManageEntity::getId, dto.getId())
.eq(ObjectUtil.isNotEmpty(dto.getParentId()), MchManageEntity::getParentId, dto.getParentId())
.eq(ObjectUtil.isNotEmpty(dto.getDeptId()), MchManageEntity::getDeptId, dto.getDeptId())
.likeIfExists(MchManageEntity::getName, dto.getName())
.in(ObjectUtil.isNotEmpty(dto.getDeptIds()), MchManageEntity::getDeptId, dto.getDeptIds())
@@ -62,6 +65,9 @@ public interface MchManageMapper extends PjcloudBaseMapper<MchManageEntity> {
.eq(ObjectUtil.isNotEmpty(dto.getVisibleMobile()), MchManageEntity::getVisibleMobile, dto.getVisibleMobile())
.eq(ObjectUtil.isNotEmpty(dto.getIsSyncZy()), MchManageEntity::getIsSyncZy, dto.getIsSyncZy())
.eq(ObjectUtil.isNotEmpty(dto.getDeptId()), MchManageEntity::getDeptId, dto.getDeptId())
.eq(ObjectUtil.isNotEmpty(dto.getSupType()), MchManageEntity::getSupType, dto.getSupType())
.eq(ObjectUtil.isNotEmpty(dto.getParentId()), MchManageEntity::getParentId, dto.getParentId())
.eq(dto.getParentIsNull(), MchManageEntity::getParentId, -1L)
.like(ObjectUtil.isNotEmpty(dto.getName()), MchManageEntity::getName, dto.getName())
.in(ObjectUtil.isNotEmpty(dto.getDeptIds()), MchManageEntity::getDeptId, dto.getDeptIds())
.in(ObjectUtil.isNotEmpty(dto.getIds()), MchManageEntity::getId, dto.getIds())
@@ -0,0 +1,20 @@
package com.bsd.pjcloud.wallet.mapper.mch;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
import com.bsd.pjcloud.wallet.api.dto.mch.MchDeptDto;
import com.bsd.pjcloud.wallet.api.entity.mch.MchDeptEntity;
import com.bsd.pjcloud.wallet.api.vo.mch.MchDeptVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface MchDeptUserMapper extends PjcloudBaseMapper<MchDeptEntity> {
Page<MchDeptVo> scopeJoinPage(Page page, @Param("dto") MchDeptDto dto, DataScope dataScope);
List<MchDeptVo> scopeJoinList(@Param("dto") MchDeptDto dto, DataScope dataScope);
}
@@ -0,0 +1,18 @@
package com.bsd.pjcloud.wallet.mapper.mch;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
import com.bsd.pjcloud.wallet.api.dto.mch.MchRuleJoinDto;
import com.bsd.pjcloud.wallet.api.entity.mch.MchRuleJoinDtoEntity;
import com.bsd.pjcloud.wallet.api.vo.mch.MchRuleJoinDtoVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface WalletRuleMchConfigMapper extends PjcloudBaseMapper<MchRuleJoinDtoEntity> {
Page<MchRuleJoinDtoVo> pageScopeList(Page page, @Param("dto") MchRuleJoinDto dto, DataScope dataScope);
MchRuleJoinDtoVo joinDetail(@Param("id") Long id);
}
@@ -0,0 +1,25 @@
package com.bsd.pjcloud.wallet.mapper.mch;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
import com.bsd.pjcloud.wallet.api.dto.mch.MchRulePriceConfigDto;
import com.bsd.pjcloud.wallet.api.entity.mch.MchRulePriceConfigEntity;
import com.bsd.pjcloud.wallet.api.vo.mch.MchRulePriceConfigVo;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface WalletRulePriceConfigMapper extends PjcloudBaseMapper<MchRulePriceConfigEntity> {
default Page<MchRulePriceConfigVo> scopePageList(Page page, MchRulePriceConfigDto dto, DataScope dataScope) {
LambdaQueryWrapper<MchRulePriceConfigEntity> wrapper = new LambdaQueryWrapper<MchRulePriceConfigEntity>()
.eq(ObjectUtil.isNotEmpty(dto.getId()), MchRulePriceConfigEntity::getId, dto.getId())
.eq(ObjectUtil.isNotEmpty(dto.getRulePriceType()), MchRulePriceConfigEntity::getRulePriceType, dto.getRulePriceType())
.orderByDesc(MchRulePriceConfigEntity::getCreateTime)
.orderByDesc(MchRulePriceConfigEntity::getRulePriceType);
return selectPageByScope(page, wrapper, dataScope);
}
}
@@ -0,0 +1,18 @@
package com.bsd.pjcloud.wallet.mapper.rule;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
import com.bsd.pjcloud.wallet.api.dto.rule.WalletRuleJoinDto;
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleJoinEntity;
import com.bsd.pjcloud.wallet.api.vo.rule.WalletRuleJoinVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface WalletRuleJoinMapper extends PjcloudBaseMapper<WalletRuleJoinEntity> {
Page<WalletRuleJoinVo> scopeJoinPage(Page page, @Param("dto") WalletRuleJoinDto dto, DataScope dataScope);
WalletRuleJoinVo joinDetail(@Param("id") Long id);
}
@@ -1,17 +0,0 @@
package com.bsd.pjcloud.wallet.mapper.rule;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
import com.bsd.pjcloud.wallet.api.dto.rule.WalletRuleMchConfigDto;
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleMchConfigEntity;
import com.bsd.pjcloud.wallet.api.vo.rule.WalletRuleMchConfigVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface WalletRuleMchConfigMapper extends PjcloudBaseMapper<WalletRuleMchConfigEntity> {
Page<WalletRuleMchConfigVo> pageScopeList(Page page, @Param("dto") WalletRuleMchConfigDto dto, DataScope dataScope);
}
@@ -1,11 +0,0 @@
package com.bsd.pjcloud.wallet.mapper.rule;
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRulePriceConfigEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface WalletRulePriceConfigMapper extends PjcloudBaseMapper<WalletRulePriceConfigEntity> {
}
@@ -0,0 +1,17 @@
package com.bsd.pjcloud.wallet.mapper.rule;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
import com.bsd.pjcloud.wallet.api.dto.rule.WalletRuleTransactionDto;
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleTransactionEntity;
import com.bsd.pjcloud.wallet.api.vo.rule.WalletRuleTransactionVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface WalletRuleTransactionMapper extends PjcloudBaseMapper<WalletRuleTransactionEntity> {
Page<WalletRuleTransactionVo> scopePageList(Page page, @Param("dto") WalletRuleTransactionDto dto, DataScope dataScope);
}
@@ -0,0 +1,27 @@
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.data.datascope.DataScope;
import com.bsd.pjcloud.wallet.api.dto.mch.MchDeptDto;
import com.bsd.pjcloud.wallet.api.entity.mch.MchDeptEntity;
import com.bsd.pjcloud.wallet.api.vo.mch.MchDeptVo;
import java.util.List;
public interface MchDeptService extends IService<MchDeptEntity> {
/**
* 同步全部
*/
void syncAll(List<Long> deptIds);
/**
* 分页复杂查询
*/
Page<MchDeptVo> scopeJoinPage(Page page, MchDeptDto dto, DataScope dataScope);
/**
* 复杂查询
*/
List<MchDeptVo> scopeJoinList(MchDeptDto dto, DataScope dataScope);
}
@@ -4,14 +4,16 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.bsd.pjcloud.common.core.constant.enums.MerchantTypeEnum;
import com.bsd.pjcloud.wallet.api.dto.MchManageDto;
import com.bsd.pjcloud.wallet.api.entity.MchManageEntity;
import com.bsd.pjcloud.wallet.api.entity.mch.MchManageEntity;
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
import java.util.ArrayList;
import java.util.List;
public interface MchManageService extends IService<MchManageEntity> {
/**
* 新增商户管理
*/
Long create(MchManageEntity dto);
void edit(MchManageEntity dto);
@@ -20,6 +22,11 @@ public interface MchManageService extends IService<MchManageEntity> {
Page<MchManageVo> pageJoin(Page page, MchManageDto dto);
/**
* 分页级联
*/
Page<MchManageVo> cascadeJoin(Page page, MchManageDto dto);
Page<MchManageVo> scopePageList(Page page, MchManageDto dto);
MchManageVo join(Long id);
@@ -0,0 +1,38 @@
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.data.datascope.DataScope;
import com.bsd.pjcloud.wallet.api.dto.mch.MchRuleJoinDto;
import com.bsd.pjcloud.wallet.api.entity.mch.MchRuleJoinDtoEntity;
import com.bsd.pjcloud.wallet.api.vo.mch.MchRuleJoinDtoVo;
import java.util.ArrayList;
public interface MchRuleJoinControllerService extends IService<MchRuleJoinDtoEntity> {
/**
* 权限分页查询
*/
Page<MchRuleJoinDtoVo> pageScopeList(Page page, MchRuleJoinDto dto, DataScope dataScope);
/**
* 新增
*/
Long create(MchRuleJoinDtoEntity dto);
/**
* 修改
*/
Long edit(MchRuleJoinDtoEntity dto);
/**
* 删除
*/
void delByIds(ArrayList<Long> list);
/**
* 复杂详情
*/
MchRuleJoinDtoVo joinDetail(Long id);
}
@@ -124,4 +124,9 @@ public interface WalletManageService extends IService<WalletManageEntity> {
* 修改部门
*/
void deptChange(Long deptId, Boolean isDel);
/**
* 是否可以删除该用户
*/
String isDel(Long userId);
}
@@ -0,0 +1,40 @@
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.data.datascope.DataScope;
import com.bsd.pjcloud.wallet.api.dto.rule.WalletRuleJoinDto;
import com.bsd.pjcloud.wallet.api.entity.mch.MchRuleJoinDtoEntity;
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleJoinEntity;
import com.bsd.pjcloud.wallet.api.vo.mch.MchRuleJoinDtoVo;
import com.bsd.pjcloud.wallet.api.vo.rule.WalletRuleJoinVo;
import java.util.ArrayList;
public interface WalletRuleJoinService extends IService<WalletRuleJoinEntity> {
/**
* 权限分页查询
*/
Page<WalletRuleJoinVo> scopeJoinPage(Page page, WalletRuleJoinDto dto, DataScope dataScope);
/**
* 新增
*/
Long create(WalletRuleJoinEntity dto);
/**
* 修改
*/
Long edit(WalletRuleJoinEntity dto);
/**
* 删除
*/
void delByIds(ArrayList<Long> list);
/**
* 复杂详情
*/
WalletRuleJoinVo joinDetail(Long id);
}
@@ -1,17 +0,0 @@
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.data.datascope.DataScope;
import com.bsd.pjcloud.wallet.api.dto.rule.WalletRuleMchConfigDto;
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleMchConfigEntity;
import com.bsd.pjcloud.wallet.api.vo.rule.WalletRuleMchConfigVo;
public interface WalletRuleMchConfigService extends IService<WalletRuleMchConfigEntity> {
/**
* 权限分页查询
*/
Page<WalletRuleMchConfigVo> pageScopeList(Page page, WalletRuleMchConfigDto dto, DataScope dataScope);
}
@@ -1,24 +1,32 @@
package com.bsd.pjcloud.wallet.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.bsd.pjcloud.wallet.api.dto.rule.WalletRulePriceConfigDto;
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRulePriceConfigEntity;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.wallet.api.dto.mch.MchRulePriceConfigDto;
import com.bsd.pjcloud.wallet.api.entity.mch.MchRulePriceConfigEntity;
import com.bsd.pjcloud.wallet.api.vo.mch.MchRulePriceConfigVo;
import java.util.ArrayList;
public interface WalletRulePriceConfigService extends IService<WalletRulePriceConfigEntity> {
public interface WalletRulePriceConfigService extends IService<MchRulePriceConfigEntity> {
/**
* 新增
*/
Long create(WalletRulePriceConfigDto dto);
Long create(MchRulePriceConfigDto dto);
/**
* 修改
*/
Long edit(WalletRulePriceConfigDto dto);
Long edit(MchRulePriceConfigDto dto);
/**
* 删除
*/
void delByIds(ArrayList<Long> list);
/**
* 权限分页查询
*/
Page<MchRulePriceConfigVo> scopePageList(Page page, MchRulePriceConfigDto dto, DataScope dataScope);
}
@@ -0,0 +1,17 @@
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.data.datascope.DataScope;
import com.bsd.pjcloud.wallet.api.dto.rule.WalletRuleTransactionDto;
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleTransactionEntity;
import com.bsd.pjcloud.wallet.api.vo.rule.WalletRuleTransactionVo;
public interface WalletRuleTransactionService extends IService<WalletRuleTransactionEntity> {
/**
* 分页复杂查询
*/
Page<WalletRuleTransactionVo> scopePageList(Page page, WalletRuleTransactionDto dto, DataScope dataScope);
}
@@ -1,5 +1,7 @@
package com.bsd.pjcloud.wallet.service;
import java.util.List;
public interface WalletThirdZyService {
/**
@@ -21,6 +23,8 @@ public interface WalletThirdZyService {
*/
void syncAllUser(Long userId);
void syncAllUser(List<Long> userIds);
/**
* 同步身份信息
*/
@@ -21,7 +21,7 @@ import com.bsd.pjcloud.wallet.api.dto.MchManageDto;
import com.bsd.pjcloud.wallet.api.dto.WalletActiveBindCardDto;
import com.bsd.pjcloud.wallet.api.dto.WalletActiveDto;
import com.bsd.pjcloud.wallet.api.dto.WalletTypeDto;
import com.bsd.pjcloud.wallet.api.entity.MchManageEntity;
import com.bsd.pjcloud.wallet.api.entity.mch.MchManageEntity;
import com.bsd.pjcloud.wallet.api.entity.WalletActiveEntity;
import com.bsd.pjcloud.wallet.api.entity.WalletManageEntity;
import com.bsd.pjcloud.wallet.api.entity.WalletTypeEntity;
@@ -39,6 +39,7 @@ import com.bsd.pjcloud.wallet.api.dto.WalletManageDto;
import com.bsd.pjcloud.wallet.api.dto.WalletTypeDto;
import com.bsd.pjcloud.wallet.api.entity.WalletActiveEntity;
import com.bsd.pjcloud.wallet.api.entity.WalletManageEntity;
import com.bsd.pjcloud.wallet.api.entity.WalletTransactionEntity;
import com.bsd.pjcloud.wallet.api.entity.WalletTypeEntity;
import com.bsd.pjcloud.wallet.api.utils.WalletDataUtil;
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
@@ -46,6 +47,7 @@ import com.bsd.pjcloud.wallet.api.vo.WalletManageBalanceVo;
import com.bsd.pjcloud.wallet.api.vo.WalletManageVo;
import com.bsd.pjcloud.wallet.api.vo.WalletSettingVo;
import com.bsd.pjcloud.wallet.mapper.WalletManageMapper;
import com.bsd.pjcloud.wallet.mapper.WalletTransactionMapper;
import com.bsd.pjcloud.wallet.mapper.WalletTypeMapper;
import com.bsd.pjcloud.wallet.service.*;
import jakarta.servlet.http.HttpServletResponse;
@@ -93,6 +95,7 @@ public class WalletManageServiceImpl extends ServiceImpl<WalletManageMapper, Wal
private final RemoteDeptService deptService;
private final StringRedisTemplate redisTemplate;
private final WalletTransactionMapper walletTransactionMapper;
@Override
@@ -445,6 +448,32 @@ public class WalletManageServiceImpl extends ServiceImpl<WalletManageMapper, Wal
// walletThirdZyService.syncAllDept(deptId, isDel);
}
/**
* 是否可以删除该用户
* 返回空字符串就是可以删除
*/
@Override
public String isDel(Long userId) {
// 查询是否有钱包记录
Long transactionCount = walletTransactionMapper.selectCount(new LambdaQueryWrapper<WalletTransactionEntity>()
.eq(WalletTransactionEntity::getUserId, userId)
);
if (transactionCount > 0) {
return "用户有消费记录,不能删除";
}
// 钱包类型
List<WalletTypeEntity> walletList = walletTypeMapper.selectList(null);
if (ObjectUtil.isEmpty(walletList)) return "";
for (WalletTypeEntity v : walletList) {
WalletManageEntity wallet = getWallet(userId, v.getId());
if (ObjectUtil.isEmpty(wallet)) continue;
if (wallet.getBalance() > 0) {
return "用户" + v.getName() + ",还有" + wallet.getBalance() / 100 + "元,不能删除";
}
}
return "";
}
private void disposeList(List<WalletManageVo> list, WalletManageDto dto) {
if (ObjectUtil.isNotEmpty(list)) {
// 用户
@@ -21,6 +21,7 @@ import com.bsd.pjcloud.common.core.util.CollectionUtils;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.wallet.api.constant.WalletBizEnum;
import com.bsd.pjcloud.wallet.api.constant.WalletTypeEnum;
import com.bsd.pjcloud.wallet.api.dto.WalletManageDto;
import com.bsd.pjcloud.wallet.api.dto.WalletTransactionDto;
import com.bsd.pjcloud.wallet.api.dto.WalletTypeDto;
@@ -33,6 +34,7 @@ import com.bsd.pjcloud.wallet.mapper.WalletManageMapper;
import com.bsd.pjcloud.wallet.mapper.WalletTransactionMapper;
import com.bsd.pjcloud.wallet.mapper.WalletTypeMapper;
import com.bsd.pjcloud.wallet.service.WalletManageService;
import com.bsd.pjcloud.wallet.service.WalletThirdZyService;
import com.bsd.pjcloud.wallet.service.WalletTransactionService;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
@@ -65,6 +67,7 @@ public class WalletTransactionServiceImpl extends ServiceImpl<WalletTransactionM
static private final String TAG = "会员钱包流水";
private final WalletManageService walletManageService;
private final WalletThirdZyService walletThirdZyService;
private final WalletManageMapper walletManageMapper;
private final WalletTypeMapper walletTypeMapper;
@@ -156,6 +159,11 @@ public class WalletTransactionServiceImpl extends ServiceImpl<WalletTransactionM
}
// 更新钱包余额
WalletTransactionEntity result = getSelf().addWalletBalance(wallet.getId(), dto.getBalance(), String.valueOf(dto.getUserId()), WalletBizEnum.UPDATE);
// 查询钱包类型
WalletTypeEntity walletType = walletTypeMapper.selectById(wallet.getWalletTypeId());
if (ObjectUtil.isNotEmpty(walletType) && ObjectUtil.equals(walletType.getUniqueCode(), WalletTypeEnum.EAT.getCode())) {
walletThirdZyService.syncAllUser(wallet.getUserId());
}
return ObjectUtil.isNotEmpty(result);
}
@@ -0,0 +1,129 @@
package com.bsd.pjcloud.wallet.service.impl.mch;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bsd.pjcloud.admin.api.dto.DeptAllListDto;
import com.bsd.pjcloud.admin.api.entity.SysDept;
import com.bsd.pjcloud.admin.api.feign.RemoteDeptService;
import com.bsd.pjcloud.admin.api.utils.DataUtil;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.wallet.api.dto.mch.MchDeptDto;
import com.bsd.pjcloud.wallet.api.entity.mch.MchDeptEntity;
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
import com.bsd.pjcloud.wallet.api.vo.mch.MchDeptVo;
import com.bsd.pjcloud.wallet.mapper.mch.MchDeptUserMapper;
import com.bsd.pjcloud.wallet.service.MchDeptService;
import com.bsd.pjcloud.wallet.service.MchManageService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 用户部门商户关系
*/
@Validated
@Slf4j
@RequiredArgsConstructor
@Service
public class MchDeptServiceImpl extends ServiceImpl<MchDeptUserMapper, MchDeptEntity> implements MchDeptService {
private final String TAG = "用户部门商户关系";
private final MchManageService mchManageService;
private final RemoteDeptService remoteDeptService;
/**
* 同步全部
*/
@Override
public void syncAll(List<Long> deptIds) {
DataScope dataScope = null;
DeptAllListDto deptDto = new DeptAllListDto();
if (ObjectUtil.isNotEmpty(deptIds)) deptDto.setDeptIds(deptIds);
List<SysDept> dpetList = remoteDeptService.getInnerDept(deptDto).getData();
if (ObjectUtil.isEmpty(dpetList)) return;
// 插入部门
List<MchDeptEntity> saveUserList = new ArrayList<>();
for (SysDept v : dpetList) {
MchDeptEntity item = new MchDeptEntity();
item.setDeptId(v.getDeptId());
// 查询所属的商户
try {
MchManageVo mch = mchManageService.getFirstMchByDeptId(v.getDeptId());
if (ObjectUtil.isEmpty(mch)) continue;
item.setMchId(mch.getId());
} catch (Exception e) {
log.error("|{}|同步全部查询不到用户对应的商户user|{}|", TAG, JSONUtil.toJsonStr(v));
continue;
}
saveUserList.add(item);
}
// 部门id重复走更新
List<Long> dpetIds = saveUserList.stream().map(MchDeptEntity::getDeptId).distinct().toList();
List<MchDeptVo> repetitionList = baseMapper.scopeJoinList(MchDeptDto.builder().dpetIds(dpetIds).build(), dataScope);
List<Long> repetitionDeptIds = repetitionList.stream().map(MchDeptEntity::getDeptId).distinct().toList();
List<MchDeptEntity> updateList = new ArrayList<>();
for (MchDeptVo i : repetitionList) {
for (MchDeptEntity j : saveUserList) {
if (ObjectUtil.equals(j.getDeptId(), i.getDeptId())) {
MchDeptEntity updateItem = new MchDeptEntity();
updateItem.setId(i.getId());
updateItem.setDeptId(i.getDeptId());
updateItem.setMchId(j.getMchId());
updateList.add(updateItem);
}
}
}
if (ObjectUtil.isNotEmpty(updateList)) {
baseMapper.updateById(updateList);
}
// 新增
List<MchDeptEntity> addList = new ArrayList<>();
for (MchDeptEntity i : saveUserList) {
if (!repetitionDeptIds.contains(i.getDeptId())) {
addList.add(i);
}
}
if (ObjectUtil.isNotEmpty(addList)) {
baseMapper.insert(addList);
}
}
/**
* 分页复杂查询
*/
@Override
public Page<MchDeptVo> scopeJoinPage(Page page, MchDeptDto dto, DataScope dataScope) {
Page<MchDeptVo> pageList = baseMapper.scopeJoinPage(page, dto, dataScope);
disposeList(pageList.getRecords(), dto);
return pageList;
}
/**
* 复杂查询
*/
@Override
public List<MchDeptVo> scopeJoinList(MchDeptDto dto, DataScope dataScope) {
List<MchDeptVo> list = baseMapper.scopeJoinList(dto, dataScope);
disposeList(list, dto);
return list;
}
private void disposeList(List<MchDeptVo> list, MchDeptDto dto) {
// 用户
if (ObjectUtil.isEmpty(list)) return;
List<Long> deptIds = list.stream().map(MchDeptVo::getDeptId).filter(ObjectUtil::isNotEmpty).distinct().toList();
if (ObjectUtil.isNotEmpty(deptIds)) {
Map<Long, SysDept> deptMap = remoteDeptService.getDeptByDeptIds(new ArrayList<>(deptIds)).getData();
if (ObjectUtil.isNotEmpty(deptMap)) DataUtil.convertDeptList(list, deptMap);
}
}
}
@@ -1,4 +1,4 @@
package com.bsd.pjcloud.wallet.service.impl;
package com.bsd.pjcloud.wallet.service.impl.mch;
import cn.hutool.core.codec.Base64;
import cn.hutool.core.util.ObjectUtil;
@@ -19,10 +19,12 @@ import com.bsd.pjcloud.common.core.util.BeanUtils;
import com.bsd.pjcloud.common.core.util.CollectionUtils;
import com.bsd.pjcloud.common.core.util.QRCodeImageGenerator;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.hard.api.utils.Drawing2D;
import com.bsd.pjcloud.wallet.api.constant.mch.WalletMchSupType;
import com.bsd.pjcloud.wallet.api.dto.MchManageDto;
import com.bsd.pjcloud.wallet.api.dto.WalletTypeDto;
import com.bsd.pjcloud.wallet.api.entity.MchManageEntity;
import com.bsd.pjcloud.wallet.api.entity.mch.MchManageEntity;
import com.bsd.pjcloud.wallet.api.entity.WalletTypeEntity;
import com.bsd.pjcloud.wallet.api.utils.WalletDataUtil;
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
@@ -36,6 +38,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Lazy;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.security.core.parameters.P;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
@@ -77,17 +80,30 @@ public class MchManageServiceImpl extends ServiceImpl<MchManageMapper, MchManage
return super.getById(id);
}
/**
* 新增商户管理
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Long create(MchManageEntity dto) {
if (ObjectUtil.isEmpty(dto.getParentId())) dto.setParentId(-1L);
if (existName(dto.getName(), dto.getTypes(), null)) {
throw new RuntimeException("商户名不能重复");
}
if (existDeptId(dto.getDeptId(), dto.getTypes(), null)) {
throw new RuntimeException("该部门已经绑定过商户");
}
if (!ObjectUtil.equals(dto.getTypes(), MerchantTypeEnum.SUPERMARKET.getType())) {
if (ObjectUtil.notEqual(dto.getParentId(), -1L)) {
throw new RuntimeException("改类型不能选择品牌");
}
}
if (ObjectUtil.isEmpty(dto.getMchCount())) {
dto.setMchCount(0L);
}
baseMapper.insert(dto);
getSelf().refreshQrcode(dto.getId());
updateMchCount(dto.getParentId());
// walletThirdZyService.syncAllMch(dto.getId(), Boolean.FALSE);
return dto.getId();
}
@@ -101,11 +117,35 @@ public class MchManageServiceImpl extends ServiceImpl<MchManageMapper, MchManage
if (existDeptId(dto.getDeptId(), dto.getTypes(), dto.getId())) {
throw new RuntimeException("该部门已经绑定过商户");
}
if (!ObjectUtil.equals(dto.getTypes(), MerchantTypeEnum.SUPERMARKET.getType())) {
if (ObjectUtil.notEqual(dto.getParentId(), -1L)) {
throw new RuntimeException("该类型不能选择品牌");
}
}
MchManageEntity mchManage = getSelf().getById(dto.getId());
Long orgParentId = mchManage.getParentId();
if (ObjectUtil.isEmpty(mchManage.getParentId())) {
mchManage.setParentId(-1L);
dto.setParentId(-1L);
}
if (ObjectUtil.isEmpty(mchManage)) {
throw new RuntimeException("商户不存在");
}
if (ObjectUtil.equals(mchManage.getTypes(), MerchantTypeEnum.SUPERMARKET.getType())) {
if (ObjectUtil.isNotEmpty(mchManage.getMchCount()) && mchManage.getMchCount() > 0) {
if (!ObjectUtil.equals(mchManage.getTypes(), dto.getTypes())) {
throw new RuntimeException("该" + MerchantTypeEnum.SUPERMARKET.getName() + "下面有子店铺,不能修改类型");
}
}
}
// 如果有parentId就不能换types
if (ObjectUtil.notEqual(mchManage.getParentId(), -1L)) {
if (!ObjectUtil.equals(mchManage.getTypes(), dto.getTypes())) {
throw new RuntimeException("该" + MerchantTypeEnum.SUPERMARKET.getName() + "下的" + WalletMchSupType.MCH.getDesc() + ",不能修改类型");
}
}
baseMapper.updateById(dto);
updateMchCount(orgParentId);
// walletThirdZyService.syncAllMch(dto.getId(), Boolean.FALSE);
}
@@ -136,6 +176,23 @@ public class MchManageServiceImpl extends ServiceImpl<MchManageMapper, MchManage
return list;
}
/**
* 分页级联
*/
@Override
public Page<MchManageVo> cascadeJoin(Page page, MchManageDto dto) {
Page<MchManageVo> pageList = scopePageList(page, dto);
if (ObjectUtil.isEmpty(pageList.getRecords())) return pageList;
for (MchManageVo v : pageList.getRecords()) {
MchManageDto childrenDto = new MchManageDto();
childrenDto.setParentId(v.getId());
List<MchManageVo> list = list(childrenDto);
if (ObjectUtil.isEmpty(list)) continue;
v.setChildren(list);
}
return pageList;
}
@Override
public Page<MchManageVo> scopePageList(Page page, MchManageDto dto) {
Page<MchManageVo> list = baseMapper.scopePageList(page, dto);
@@ -244,6 +301,22 @@ public class MchManageServiceImpl extends ServiceImpl<MchManageMapper, MchManage
}
}
/**
* 更新分店数量
*/
private void updateMchCount(Long orgParentId) {
if (ObjectUtil.equals(orgParentId, -1L)) return;
Long count = baseMapper.selectCount(new LambdaQueryWrapper<MchManageEntity>()
.eq(MchManageEntity::getParentId, orgParentId)
);
if (ObjectUtil.isNotEmpty(count)) {
MchManageEntity updateEntity = new MchManageEntity();
updateEntity.setId(orgParentId);
updateEntity.setMchCount(count);
updateById(updateEntity);
}
}
private String generateMchOrder(MchManageEntity mchDetail) {
try {
MchCollectionCodeVo mchCollectionCode = new MchCollectionCodeVo();
@@ -0,0 +1,116 @@
package com.bsd.pjcloud.wallet.service.impl.mch;
import cn.hutool.core.util.ObjectUtil;
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.common.data.datascope.DataScope;
import com.bsd.pjcloud.wallet.api.constant.mch.WalletMchRulePriceTypeEnum;
import com.bsd.pjcloud.wallet.api.dto.mch.MchRuleJoinDto;
import com.bsd.pjcloud.wallet.api.entity.mch.MchManageEntity;
import com.bsd.pjcloud.wallet.api.entity.mch.MchRuleJoinDtoEntity;
import com.bsd.pjcloud.wallet.api.entity.mch.MchRulePriceConfigEntity;
import com.bsd.pjcloud.wallet.api.vo.mch.MchRuleJoinDtoVo;
import com.bsd.pjcloud.wallet.mapper.mch.WalletRuleMchConfigMapper;
import com.bsd.pjcloud.wallet.service.MchManageService;
import com.bsd.pjcloud.wallet.service.MchRuleJoinControllerService;
import com.bsd.pjcloud.wallet.service.WalletRulePriceConfigService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import java.util.ArrayList;
@Validated
@Slf4j
@RequiredArgsConstructor
@Service
public class MchRuleJoinControllerServiceImpl extends ServiceImpl<WalletRuleMchConfigMapper, MchRuleJoinDtoEntity> implements MchRuleJoinControllerService {
private final MchManageService mchManageService;
private final WalletRulePriceConfigService rulePriceConfigService;
@Override
public Long create(MchRuleJoinDtoEntity dto) {
if (existMchRuleJoin(dto)) {
throw new RuntimeException("绑定的规则类型不能重复");
}
// 查询配置规则
MchRulePriceConfigEntity rulePriceConfig = rulePriceConfigService.getById(dto.getRulePriceConfigId());
if (ObjectUtil.notEqual(rulePriceConfig.getRulePriceType(), WalletMchRulePriceTypeEnum.EVERY_LIMIT.getCode())) {
if (areMchIdsDistinct(dto)) {
throw new RuntimeException("源商户与目标商户不能重复");
}
}
MchManageEntity targetMch = mchManageService.getById(dto.getTargetMchId());
if (ObjectUtil.isEmpty(targetMch)) {
throw new RuntimeException("目标商户不存在");
}
dto.setTargetDeptId(targetMch.getDeptId());
baseMapper.insert(dto);
return dto.getId();
}
@Override
public Long edit(MchRuleJoinDtoEntity dto) {
if (existMchRuleJoin(dto)) {
throw new RuntimeException("绑定的规则类型不能重复");
}
if (areMchIdsDistinct(dto)) {
throw new RuntimeException("源商户与目标商户不能重复");
}
MchManageEntity targetMch = mchManageService.getById(dto.getTargetMchId());
if (ObjectUtil.isEmpty(targetMch)) {
throw new RuntimeException("目标商户不存在");
}
dto.setTargetDeptId(targetMch.getDeptId());
baseMapper.updateById(dto);
return dto.getId();
}
@Override
public void delByIds(ArrayList<Long> list) {
if (ObjectUtil.isEmpty(list)) return;
baseMapper.deleteByIds(list);
}
@Override
public MchRuleJoinDtoVo joinDetail(Long id) {
return baseMapper.joinDetail(id);
}
/**
* 权限分页查询
*/
@Override
public Page<MchRuleJoinDtoVo> pageScopeList(Page page, MchRuleJoinDto dto, DataScope dataScope) {
return baseMapper.pageScopeList(page, dto, dataScope);
}
/**
* 是否重复
*/
private boolean existMchRuleJoin(MchRuleJoinDtoEntity dto) {
Long count = baseMapper.selectCount(new LambdaQueryWrapper<MchRuleJoinDtoEntity>()
.eq(ObjectUtil.isNotEmpty(dto.getSourceMchId()), MchRuleJoinDtoEntity::getSourceMchId, dto.getSourceMchId())
.eq(ObjectUtil.isNotEmpty(dto.getRulePriceConfigId()), MchRuleJoinDtoEntity::getRulePriceConfigId, dto.getRulePriceConfigId())
.ne(ObjectUtil.isNotEmpty(dto.getId()), MchRuleJoinDtoEntity::getId, dto.getId())
);
if (ObjectUtil.isNotEmpty(dto.getId())) {
return count >= 1;
}
return count > 0;
}
/**
* sourceMchId和targetMchId是否重复
*/
private boolean areMchIdsDistinct(MchRuleJoinDtoEntity dto) {
if (!ObjectUtil.isAllNotEmpty(dto.getSourceMchId(), dto.getTargetMchId())) {
return false;
}
return ObjectUtil.equals(dto.getSourceMchId(), dto.getTargetMchId());
}
}
@@ -1,13 +1,16 @@
package com.bsd.pjcloud.wallet.service.impl.rule;
package com.bsd.pjcloud.wallet.service.impl.mch;
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.common.core.constant.CacheConstants;
import com.bsd.pjcloud.wallet.api.dto.rule.WalletRulePriceConfigDto;
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRulePriceConfigEntity;
import com.bsd.pjcloud.wallet.mapper.rule.WalletRulePriceConfigMapper;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.wallet.api.dto.mch.MchRulePriceConfigDto;
import com.bsd.pjcloud.wallet.api.entity.mch.MchRulePriceConfigEntity;
import com.bsd.pjcloud.wallet.api.vo.mch.MchRulePriceConfigVo;
import com.bsd.pjcloud.wallet.mapper.mch.WalletRulePriceConfigMapper;
import com.bsd.pjcloud.wallet.service.WalletRulePriceConfigService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -20,23 +23,17 @@ import org.springframework.validation.annotation.Validated;
import java.io.Serializable;
import java.util.ArrayList;
/**
* 钱包规则
*
* @author dzc
* @date 2025-03-26 11:09:52
*/
@Validated
@Slf4j
@RequiredArgsConstructor
@Service
public class WalletRulePriceConfigServiceImpl extends ServiceImpl<WalletRulePriceConfigMapper, WalletRulePriceConfigEntity> implements WalletRulePriceConfigService {
public class MchRulePriceConfigServiceImpl extends ServiceImpl<WalletRulePriceConfigMapper, MchRulePriceConfigEntity> implements WalletRulePriceConfigService {
private final StringRedisTemplate redisTemplate;
@Override
@Cacheable(value = CacheConstants.WALLET_RULE_PRICE_CONFIG_DETAIL, key = "#id", condition = "#id != null", unless = "#result == null")
public WalletRulePriceConfigEntity getById(Serializable id) {
public MchRulePriceConfigEntity getById(Serializable id) {
return super.getById(id);
}
@@ -45,7 +42,7 @@ public class WalletRulePriceConfigServiceImpl extends ServiceImpl<WalletRulePric
*/
@Override
@CacheEvict(value = CacheConstants.WALLET_RULE_PRICE_CONFIG_DETAIL, key = "#dto.getId()", condition = "#dto.getId() != null")
public Long create(WalletRulePriceConfigDto dto) {
public Long create(MchRulePriceConfigDto dto) {
if (existRulePriceType(dto.getRulePriceType(), null)) {
throw new RuntimeException("规则类型不能重复");
}
@@ -58,11 +55,11 @@ public class WalletRulePriceConfigServiceImpl extends ServiceImpl<WalletRulePric
*/
@Override
@CacheEvict(value = CacheConstants.WALLET_RULE_PRICE_CONFIG_DETAIL, key = "#dto.getId()", condition = "#dto.getId() != null")
public Long edit(WalletRulePriceConfigDto dto) {
public Long edit(MchRulePriceConfigDto dto) {
if (existRulePriceType(dto.getRulePriceType(), dto.getId())) {
throw new RuntimeException("规则类型不能重复");
}
WalletRulePriceConfigEntity detial = getSelf().getById(dto.getId());
MchRulePriceConfigEntity detial = getSelf().getById(dto.getId());
if (ObjectUtil.isEmpty(detial)) throw new RuntimeException("商户不存在");
baseMapper.updateById(dto);
return dto.getId();
@@ -77,15 +74,22 @@ public class WalletRulePriceConfigServiceImpl extends ServiceImpl<WalletRulePric
// 删除缓存
list.forEach(v -> {
redisTemplate.opsForValue().getAndDelete(CacheConstants.WALLET_RULE_PRICE_CONFIG_DETAIL + v);
// walletThirdZyService.syncAllMch(v, Boolean.TRUE);
});
baseMapper.deleteByIds(list);
}
/**
* 权限分页查询
*/
@Override
public Page<MchRulePriceConfigVo> scopePageList(Page page, MchRulePriceConfigDto dto, DataScope dataScope) {
return baseMapper.scopePageList(page, dto, dataScope);
}
private boolean existRulePriceType(String rulePriceConfigType, Long id) {
Long count = baseMapper.selectCount(new LambdaQueryWrapper<WalletRulePriceConfigEntity>()
.eq(ObjectUtil.isNotEmpty(rulePriceConfigType), WalletRulePriceConfigEntity::getRulePriceType, rulePriceConfigType)
.ne(ObjectUtil.isNotEmpty(id), WalletRulePriceConfigEntity::getId, id)
Long count = baseMapper.selectCount(new LambdaQueryWrapper<MchRulePriceConfigEntity>()
.eq(ObjectUtil.isNotEmpty(rulePriceConfigType), MchRulePriceConfigEntity::getRulePriceType, rulePriceConfigType)
.ne(ObjectUtil.isNotEmpty(id), MchRulePriceConfigEntity::getId, id)
);
if (ObjectUtil.isNotEmpty(id)) {
return count >= 1;
@@ -93,7 +97,7 @@ public class WalletRulePriceConfigServiceImpl extends ServiceImpl<WalletRulePric
return count > 0;
}
private WalletRulePriceConfigServiceImpl getSelf() {
private MchRulePriceConfigServiceImpl getSelf() {
return SpringUtil.getBean(getClass());
}
}
@@ -47,10 +47,7 @@ import com.bsd.pjcloud.wallet.api.vo.recharge.excel.WalletRechargeByApplyExcelVo
import com.bsd.pjcloud.wallet.mapper.WalletTransactionMapper;
import com.bsd.pjcloud.wallet.mapper.WalletTypeMapper;
import com.bsd.pjcloud.wallet.mapper.recharge.WalletRechargeApplyMapper;
import com.bsd.pjcloud.wallet.service.WalletManageService;
import com.bsd.pjcloud.wallet.service.WalletRechargeApplyService;
import com.bsd.pjcloud.wallet.service.WalletTransactionService;
import com.bsd.pjcloud.wallet.service.WalletTypeService;
import com.bsd.pjcloud.wallet.service.*;
import com.bsd.pjcloud.wallet.utils.flow.FlowUtil;
import com.bsd.pjcloud.wallet.utils.flow.dto.WalletRechargeApplyFlowDto;
@@ -88,6 +85,7 @@ public class WalletRechargeApplyServiceImpl extends ServiceImpl<WalletRechargeAp
private final WalletTransactionMapper walletTransactionMapper;
private final WalletTypeMapper walletTypeMapper;
private final WalletThirdZyService walletThirdZyService;
private final RemoteUserService userService;
private final RemoteDeptService deptService;
@@ -320,6 +318,16 @@ public class WalletRechargeApplyServiceImpl extends ServiceImpl<WalletRechargeAp
}
walletTransactionService.addWalletBalance(wallet.getId(), v.getPrice(), String.valueOf(v.getId()), WalletBizEnum.BATCH);
}
// 同步到正元钱包状态
List<Long> userIds = importList.stream().map(WalletRechargeImportEntity::getUserId).distinct().toList();
if (ObjectUtil.isNotEmpty(userIds)) {
try {
walletThirdZyService.syncAllUser(userIds);
} catch (Exception e) {
// 不要抛出异常
log.error("|{}|审批回调同步到正元钱包状态失败,dto:|{}|error:|{}|", TAG, JSON.toJSONString(dto), e.getMessage());
}
}
log.info("|{}|审批回调成功,dto:|{}", TAG, JSON.toJSONString(dto));
}
} catch (Exception e) {
@@ -0,0 +1,121 @@
package com.bsd.pjcloud.wallet.service.impl.rule;
import cn.hutool.core.util.ObjectUtil;
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.common.data.datascope.DataScope;
import com.bsd.pjcloud.wallet.api.dto.rule.WalletRuleJoinDto;
import com.bsd.pjcloud.wallet.api.entity.WalletTypeEntity;
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleJoinEntity;
import com.bsd.pjcloud.wallet.api.vo.rule.WalletRuleJoinVo;
import com.bsd.pjcloud.wallet.mapper.rule.WalletRuleJoinMapper;
import com.bsd.pjcloud.wallet.service.WalletRuleJoinService;
import com.bsd.pjcloud.wallet.service.WalletTypeService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import java.util.ArrayList;
/**
* 钱包规则配置
*/
@Validated
@Slf4j
@RequiredArgsConstructor
@Service
public class WalletRuleJoinServiceImpl extends ServiceImpl<WalletRuleJoinMapper, WalletRuleJoinEntity> implements WalletRuleJoinService {
private final WalletTypeService walletTypeService;
/**
* 权限分页查询
*/
@Override
public Page<WalletRuleJoinVo> scopeJoinPage(Page page, WalletRuleJoinDto dto, DataScope dataScope) {
return baseMapper.scopeJoinPage(page, dto, dataScope);
}
/**
* 新增
*/
@Override
public Long create(WalletRuleJoinEntity dto) {
if (existWalletRuleJoin(dto)) {
throw new RuntimeException("绑定类型不能重复");
}
if (areWalletIdsDistinct(dto)) {
throw new RuntimeException("源钱包类型与目标钱包类型不能重复");
}
WalletTypeEntity targetMch = walletTypeService.getById(dto.getTargetWalletTypeId());
if (ObjectUtil.isEmpty(targetMch)) {
throw new RuntimeException("目标钱包类型不存在");
}
baseMapper.insert(dto);
return dto.getId();
}
/**
* 修改
*/
@Override
public Long edit(WalletRuleJoinEntity dto) {
if (existWalletRuleJoin(dto)) {
throw new RuntimeException("绑定类型不能重复");
}
if (areWalletIdsDistinct(dto)) {
throw new RuntimeException("源钱包类型与目标钱包类型不能重复");
}
WalletTypeEntity targetMch = walletTypeService.getById(dto.getTargetWalletTypeId());
if (ObjectUtil.isEmpty(targetMch)) {
throw new RuntimeException("目标钱包类型不存在");
}
baseMapper.updateById(dto);
return dto.getId();
}
/**
* 删除
*/
@Override
public void delByIds(ArrayList<Long> list) {
if (ObjectUtil.isEmpty(list)) return;
baseMapper.deleteByIds(list);
}
/**
* 复杂详情
*/
@Override
public WalletRuleJoinVo joinDetail(Long id) {
return baseMapper.joinDetail(id);
}
/**
* 是否重复
*/
private boolean existWalletRuleJoin(WalletRuleJoinEntity dto) {
Long count = baseMapper.selectCount(new LambdaQueryWrapper<WalletRuleJoinEntity>()
.eq(ObjectUtil.isNotEmpty(dto.getSourceWalletTypeId()), WalletRuleJoinEntity::getSourceWalletTypeId, dto.getSourceWalletTypeId())
.eq(ObjectUtil.isNotEmpty(dto.getTargetWalletTypeId()), WalletRuleJoinEntity::getTargetWalletTypeId, dto.getTargetWalletTypeId())
.eq(ObjectUtil.isNotEmpty(dto.getTargetDeptId()), WalletRuleJoinEntity::getTargetDeptId, dto.getTargetDeptId())
.ne(ObjectUtil.isNotEmpty(dto.getId()), WalletRuleJoinEntity::getId, dto.getId())
);
if (ObjectUtil.isNotEmpty(dto.getId())) {
return count >= 1;
}
return count > 0;
}
/**
* sourceWalletTypeId和targetWalletTypeId是否重复
*/
private boolean areWalletIdsDistinct(WalletRuleJoinEntity dto) {
if (!ObjectUtil.isAllNotEmpty(dto.getSourceWalletTypeId(), dto.getTargetWalletTypeId())) {
return false;
}
return ObjectUtil.equals(dto.getSourceWalletTypeId(), dto.getTargetWalletTypeId());
}
}
@@ -1,29 +0,0 @@
package com.bsd.pjcloud.wallet.service.impl.rule;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.wallet.api.dto.rule.WalletRuleMchConfigDto;
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleMchConfigEntity;
import com.bsd.pjcloud.wallet.api.vo.rule.WalletRuleMchConfigVo;
import com.bsd.pjcloud.wallet.mapper.rule.WalletRuleMchConfigMapper;
import com.bsd.pjcloud.wallet.service.WalletRuleMchConfigService;
import org.springframework.stereotype.Service;
/**
* 商户规格配置表
*
* @author pjcloud
* @date 2025-03-26 11:14:39
*/
@Service
public class WalletRuleMchConfigServiceImpl extends ServiceImpl<WalletRuleMchConfigMapper, WalletRuleMchConfigEntity> implements WalletRuleMchConfigService {
/**
* 权限分页查询
*/
@Override
public Page<WalletRuleMchConfigVo> pageScopeList(Page page, WalletRuleMchConfigDto dto, DataScope dataScope) {
return baseMapper.pageScopeList(page, dto, dataScope);
}
}
@@ -0,0 +1,32 @@
package com.bsd.pjcloud.wallet.service.impl.rule;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.wallet.api.dto.rule.WalletRuleTransactionDto;
import com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleTransactionEntity;
import com.bsd.pjcloud.wallet.api.vo.rule.WalletRuleTransactionVo;
import com.bsd.pjcloud.wallet.mapper.rule.WalletRuleTransactionMapper;
import com.bsd.pjcloud.wallet.service.WalletRuleTransactionService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
/**
* 钱包转账记录
*/
@Validated
@Slf4j
@RequiredArgsConstructor
@Service
public class WalletRuleTransactionServiceImpl extends ServiceImpl<WalletRuleTransactionMapper, WalletRuleTransactionEntity> implements WalletRuleTransactionService {
/**
* 分页复杂查询
*/
@Override
public Page<WalletRuleTransactionVo> scopePageList(Page page, WalletRuleTransactionDto dto, DataScope dataScope) {
return baseMapper.scopePageList(page, dto, dataScope);
}
}
@@ -5,7 +5,9 @@ import cn.hutool.core.date.LocalDateTimeUtil;
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.DeptAllListDto;
import com.bsd.pjcloud.admin.api.dto.UserDTO;
import com.bsd.pjcloud.admin.api.dto.UserInfo;
import com.bsd.pjcloud.admin.api.entity.SysDept;
import com.bsd.pjcloud.admin.api.entity.SysRole;
import com.bsd.pjcloud.admin.api.feign.RemoteDeptService;
@@ -187,9 +189,14 @@ public class WalletThirdZyServiceImpl implements WalletThirdZyService {
}
}
@Override
public void syncAllUser(Long userId) {
syncAllUser(List.of(userId));
}
@Override
public void syncAllUser(List<Long> userIds) {
Page page = new Page();
page.setCurrent(1);
page.setSize(100);
@@ -200,8 +207,9 @@ public class WalletThirdZyServiceImpl implements WalletThirdZyService {
return;
}
// 查询可以同步到正元的部门
List<SysDept> deptList = remoteDeptService.getAllDept(null).getData();
deptList = deptList.stream().filter(v -> ObjectUtil.equals(v.getIsSyncZy(), YesNoEnum.YES.getCode())).toList();
DeptAllListDto deptDto = new DeptAllListDto();
deptDto.setIsSyncZy(YesNoEnum.YES.getCode());
List<SysDept> deptList = remoteDeptService.getInnerAllDept(deptDto).getData();
if (ObjectUtil.isEmpty(deptList)) {
log.info("|{}| syncAllUser 错误 可以同步到正元的部门为空", TAG);
return;
@@ -220,7 +228,7 @@ public class WalletThirdZyServiceImpl implements WalletThirdZyService {
}
int total = 0;
while (true) {
int syncCount = syncAllUserGroup(page, userId, defaultUserRole.get().getRoleId(), walletType.getId(), syncZyDeptIds);
int syncCount = syncAllUserGroup(page, userIds, defaultUserRole.get().getRoleId(), walletType.getId(), syncZyDeptIds);
if (syncCount > 0) {
total += syncCount;
}
@@ -231,11 +239,10 @@ public class WalletThirdZyServiceImpl implements WalletThirdZyService {
}
private int syncAllUserGroup(Page page, Long userId, Long roleId, Long walletTypeId, List<Long> syncZyDeptIds) {
private int syncAllUserGroup(Page page, List<Long> userIds, Long roleId, Long walletTypeId, List<Long> syncZyDeptIds) {
UserDTO query = new UserDTO();
if (ObjectUtil.isNotEmpty(userId)) {
query.setUserId(userId);
}
query.setIsFindCheckUser(false);
if (ObjectUtil.isNotEmpty(userIds)) query.setUserIds(userIds);
if (ObjectUtil.isNotEmpty(syncZyDeptIds)) {
query.setDeptIds(syncZyDeptIds);
}
@@ -246,7 +253,9 @@ public class WalletThirdZyServiceImpl implements WalletThirdZyService {
List<ZyMerSyncAccountInfoDto> syncList = new ArrayList<>();
String syncAllMchVersion = getSyncAllMchVersion();
for (UserVO v : userVOList) {
if (ObjectUtil.isEmpty(v) || ObjectUtil.isEmpty(v.getUserId())) {
// 查询用户手机号
UserInfo userInfo = remoteUserService.getByUserId(v.getUserId()).getData();
if (ObjectUtil.isEmpty(userInfo)) {
log.error("|{}|syncAllUserGroup用户不存在WalletManageVo|{}|", TAG, JSONUtil.toJsonStr(v));
continue;
}
@@ -277,10 +286,6 @@ public class WalletThirdZyServiceImpl implements WalletThirdZyService {
continue;
}
}
if (userWallet.getBalance() > 4000) {
log.error("|{}|余额大于40本次不更新|{}|", TAG, v.getUserId());
continue;
}
ZyMerSyncAccountInfoDto item = new ZyMerSyncAccountInfoDto();
item.setAccName(v.getName());
item.setAccNum(v.getUserId().toString());
@@ -290,7 +295,7 @@ public class WalletThirdZyServiceImpl implements WalletThirdZyService {
item.setEPID(v.getDeptId().toString());
item.setPerCode(v.getUserId().toString());
item.setAccClassID(roleId.toString());
item.setPhoneNo(v.getPhone());
item.setPhoneNo(userInfo.getSysUser().getPhone());
item.setFixId(syncAllMchVersion);
syncList.add(item);
}
@@ -2,17 +2,17 @@
<!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">
<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="isRule" column="is_rule"/>
<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>
</resultMap>
</mapper>
@@ -0,0 +1,66 @@
<?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.mch.MchDeptUserMapper">
<resultMap id="mchDeptUserMap" type="com.bsd.pjcloud.wallet.api.entity.mch.MchDeptEntity">
<id property="id" column="id"/>
<result property="mchId" column="mch_id"/>
<result property="deptId" column="dept_id"/>
<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>
<sql id="selectA">
select a.id,
a.mch_id,
a.dept_id,
a.create_by,
a.create_time,
a.update_by,
a.update_time,
a.del_flag,
a.tenant_id,
</sql>
<sql id="whereA">
<if test="dto.mchId != null">
and a.mch_id = #{dto.mchId}
</if>
<if test="dto.deptId != null">
and a.dpet_id = #{dto.deptId}
</if>
<if test="dto.mchIds != null and dto.mchIds.size() != 0">
and a.mch_id in
<foreach collection="dto.mchIds" item="v" open="(" close=")" separator=",">
#{v}
</foreach>
</if>
</sql>
<sql id="selectList">
<include refid="selectA"/>
m.id as merchantId,
m.name as merchantName,
m.logo_pic as logoPic
from mch_dept a
left join mch_manage m on m.id = a.mch_id
<where>
<include refid="whereA"/>
<if test="dto.merchantName != null and dto.merchantName != '' ">
and m.name like concat('%', #{dto.merchantName}, '%')
</if>
</where>
</sql>
<select id="scopeJoinPage" resultType="com.bsd.pjcloud.wallet.api.vo.mch.MchDeptVo">
<include refid="selectList"/>
</select>
<select id="scopeJoinList" resultType="com.bsd.pjcloud.wallet.api.vo.mch.MchDeptVo">
<include refid="selectList"/>
</select>
</mapper>
@@ -2,7 +2,7 @@
<!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.MchManageMapper">
<resultMap id="mchManageMap" type="com.bsd.pjcloud.wallet.api.entity.MchManageEntity">
<resultMap id="mchManageMap" type="com.bsd.pjcloud.wallet.api.entity.mch.MchManageEntity">
<id property="id" column="id"/>
<result property="deptId" column="dept_id"/>
<result property="defaultWalletTypeId" column="default_wallet_type_id"/>
@@ -14,6 +14,10 @@
<result property="phone" column="phone"/>
<result property="jobTime" column="job_time"/>
<result property="addressDes" column="address_des"/>
<result property="supType" column="sup_type"/>
<result property="discountsPrice" column="discounts_price"/>
<result property="cooperationStatus" column="cooperation_status"/>
<result property="mchCount" column="mch_count"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
@@ -1,13 +1,14 @@
<?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.rule.WalletRuleMchConfigMapper">
<resultMap id="walletRuleMchConfigMap" type="com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleMchConfigEntity">
<mapper namespace="com.bsd.pjcloud.wallet.mapper.mch.WalletRuleMchConfigMapper">
<resultMap id="walletRuleMchConfigMap" type="com.bsd.pjcloud.wallet.api.entity.mch.MchRuleJoinDtoEntity">
<result property="id" column="id"/>
<result property="sourceMchId" column="source_mch_id"/>
<result property="targetMchId" column="target_mch_id"/>
<result property="tragetDeptId" column="traget_dept_id"/>
<result property="targetDeptId" column="target_dept_id"/>
<result property="rulePriceConfigId" column="rule_price_config_id"/>
<result property="status" column="status"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
@@ -21,6 +22,7 @@
a.source_mch_id,
a.target_mch_id,
a.rule_price_config_id,
a.status,
a.create_by,
a.create_time,
a.update_by,
@@ -42,17 +44,38 @@
</if>
</sql>
<select id="pageScopeList" resultType="com.bsd.pjcloud.wallet.api.vo.rule.WalletRuleMchConfigVo">
<select id="pageScopeList" resultType="com.bsd.pjcloud.wallet.api.vo.mch.MchRuleJoinDtoVo">
<include refid="selectA"/>
p.id as rulePirceConfigId,
p.rule_price_type,
p.base_price,
p.multiple
from wallet_rule_mch_config a
left join wallet_rule_price_config p on a.rule_price_config_id = p.id
p.multiple,
source.name as sourceMchName,
target.name as targetMchName
from mch_rule_join a
left join mch_rule_price_config p on a.rule_price_config_id = p.id
left join mch_manage source on source.id = a.source_mch_id
left join mch_manage target on target.id = a.target_mch_id
<where>
<include refid="whereA"/>
</where>
order by a.create_time desc , a.id desc
</select>
<select id="joinDetail" resultType="com.bsd.pjcloud.wallet.api.vo.mch.MchRuleJoinDtoVo">
<include refid="selectA"/>
p.id as rulePirceConfigId,
p.rule_price_type as rulePriceType,
p.base_price as basePrice,
p.multiple as multiple,
source.name as sourceMchName,
target.name as targetMchName
from mch_rule_join a
left join mch_rule_price_config p on a.rule_price_config_id = p.id
left join mch_manage source on source.id = a.source_mch_id
left join mch_manage target on target.id = a.target_mch_id
<where>
a.id = #{id}
</where>
</select>
</mapper>
@@ -1,9 +1,9 @@
<?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.rule.WalletRulePriceConfigMapper">
<mapper namespace="com.bsd.pjcloud.wallet.mapper.mch.WalletRulePriceConfigMapper">
<resultMap id="walletRulePriceConfigMap" type="com.bsd.pjcloud.wallet.api.entity.rule.WalletRulePriceConfigEntity">
<resultMap id="walletRulePriceConfigMap" type="com.bsd.pjcloud.wallet.api.entity.mch.MchRulePriceConfigEntity">
<result property="id" column="id"/>
<result property="rulePriceType" column="rule_price_type"/>
<result property="basePrice" column="base_price"/>
@@ -15,4 +15,6 @@
<result property="delFlag" column="del_flag"/>
<result property="tenantId" column="tenant_id"/>
</resultMap>
</mapper>
@@ -0,0 +1,79 @@
<?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.rule.WalletRuleJoinMapper">
<resultMap id="walletRuleJoinMap" type="com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleJoinEntity">
<id property="id" column="id"/>
<result property="sourceWalletTypeId" column="source_wallet_type_id"/>
<result property="targetWalletTypeId" column="target_wallet_type_id"/>
<result property="targetDeptId" column="target_dept_id"/>
<result property="balanceMultiple" column="balance_multiple"/>
<result property="status" column="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>
<sql id="sleectA">
select a.id,
a.source_wallet_type_id,
a.target_wallet_type_id,
a.target_dept_id,
a.balance_multiple,
a.status,
a.create_by,
a.create_time,
a.update_by,
a.update_time,
a.del_flag,
a.tenant_id,
</sql>
<sql id="whereA">
a.del_flag = 0
<if test="dto.sourceWalletTypeId != null">
and a.source_wallet_type_id = #{dto.sourceWalletTypeId}
</if>
<if test="dto.targetWalletTypeId != null">
and a.target_wallet_type_id = #{dto.targetWalletTypeId}
</if>
<if test="dto.targetDeptId != null">
and a.target_dept_id = #{dto.targetDeptId}
</if>
</sql>
<select id="scopeJoinPage" resultType="com.bsd.pjcloud.wallet.api.vo.rule.WalletRuleJoinVo">
<include refid="sleectA"/>
source.name as sourceName,
source.unique_code as sourceUniqueCode,
source.icon as sourceIcon,
target.name as targetName,
target.unique_code as targetUniqueCode,
target.icon as targetIcon
from wallet_rule_join a
left join wallet_type source on source.id = a.source_wallet_type_id
left join wallet_type target on target.id = a.target_wallet_type_id
<where>
<include refid="whereA"/>
</where>
</select>
<select id="joinDetail" resultType="com.bsd.pjcloud.wallet.api.vo.rule.WalletRuleJoinVo">
<include refid="sleectA"/>
source.name as sourceName,
source.unique_code as sourceUniqueCode,
source.icon as sourceIcon,
target.name as targetName,
target.unique_code as targetUniqueCode,
target.icon as targetIcon
from wallet_rule_join a
left join wallet_type source on source.id = a.source_wallet_type_id
left join wallet_type target on target.id = a.target_wallet_type_id
<where>
a.id = #{id}
</where>
</select>
</mapper>
@@ -0,0 +1,85 @@
<?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.rule.WalletRuleTransactionMapper">
<resultMap id="walletRuleTransactionMap" type="com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleTransactionEntity">
<id property="id" column="id"/>
<result property="sourceWalletId" column="source_wallet_id"/>
<result property="targetWalletId" column="target_wallet_id"/>
<result property="sourceWalletBalance" column="source_wallet_balance"/>
<result property="targetWalletBalance" column="target_wallet_balance"/>
<result property="balance" column="balance"/>
<result property="afterBalance" column="after_balance"/>
<result property="balanceMultiple" column="balance_multiple"/>
<result property="isRefund" column="is_refund"/>
<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>
<sql id="selectA">
select a.id,
a.source_wallet_id,
a.target_wallet_id,
a.source_wallet_balance,
a.target_wallet_balance,
a.balance,
a.after_balance,
a.balance_multiple,
a.is_refund,
a.create_by,
a.create_time,
a.update_by,
a.update_time,
a.del_flag,
a.tenant_id,
</sql>
<sql id="whereA">
a.del_flag = 0
<if test="dto.sourceWalletId != null">
and a.source_wallet_id = #{dto.sourceWalletId}
</if>
<if test="dto.targetWalletId != null">
and a.target_wallet_id = #{dto.targetWalletId}
</if>
</sql>
<select id="scopePageList" resultType="com.bsd.pjcloud.wallet.api.vo.rule.WalletRuleTransactionVo">
<include refid="selectA"/>
t.user_id,
t.dept_id,
sourceWalletType.name as sourceWalletTypeName,
sourceWalletType.unique_code as sourceWalletTypeCode,
targetWalletType.name as targetWalletTypeName,
targetWalletType.unique_code as targetWalletTypeCode
from wallet_rule_transaction a
left join wallet_transaction t on t.biz_id = a.id and biz_type = '6'
left join wallet_manage sourceWallet on sourceWallet.id = a.source_wallet_id
left join wallet_type sourceWalletType on sourceWalletType.id = sourceWallet.wallet_type_id
left join wallet_manage targetWallet on targetWallet.id = a.target_wallet_id
left join wallet_type targetWalletType on targetWalletType.id = targetWallet.wallet_type_id
<where>
<include refid="whereA"/>
<if test="dto.deptIds != null and dto.deptIds.size() != 0">
<choose>
<when test="dto.isInclude != null and dto.isInclude == true">
and a.dept_id IN
</when>
<when test="dto.isInclude != null and dto.isInclude == false">
and a.dept_id NOT IN
</when>
<otherwise>
and a.dept_id IN
</otherwise>
</choose>
<foreach collection="dto.deptIds" item="v" open="(" close=")" separator=",">
#{v}
</foreach>
</if>
</where>
</select>
</mapper>