feaet:充值同步到正元

This commit is contained in:
dzc committed 2025-03-29 10:38:47 +08:00
1 parent a1c8527a3a
commit ffee069910
61 files changed
+839 -490

No files matched your search

+17 -18
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 NOT NULL COMMENT '主键',
mch_id bigint NOT NULL COMMENT '商户id',
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',
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT ='用户部门商户关系表';
COLLATE = utf8mb4_general_ci COMMENT ='商户部门关系表';
-- ----------------------------
-- Table structure for wallet_manage
@@ -113,10 +112,10 @@ 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 '规则类型',
@@ -135,8 +134,8 @@ CREATE TABLE wallet_rule_price_config
-- ----------------------------
-- Table structure for wallet_rule_mch_config
-- ----------------------------
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',
@@ -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;
}
@@ -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);
@@ -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());
}
/**
@@ -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
*/
@@ -268,6 +268,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查询用户信息
*
@@ -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,
@@ -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;
}
@@ -1,9 +0,0 @@
package com.bsd.pjcloud.wallet.api.dto.mch;
import com.bsd.pjcloud.wallet.api.entity.mch.MchDeptUserEntity;
import lombok.Data;
@Data
public class MchDeptUserDto extends MchDeptUserEntity {
}
@@ -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 {
}
@@ -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,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,91 +0,0 @@
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;
/**
* 用户部门商户关系表
*
* @author pjcloud
* @date 2025-03-28 15:28:00
*/
@Data
@TenantTable
@TableName("mch_dept_user")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "用户部门商户关系表")
public class MchDeptUserEntity extends Model<MchDeptUserEntity> {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description="主键")
private Long id;
/**
* 商户id
*/
@Schema(description="商户id")
private Long mchId;
/**
* 用户id
*/
@Schema(description="用户id")
private Long userId;
/**
* 用户部门id
*/
@Schema(description="用户部门id")
private Long userDeptId;
/**
* 创建人
*/
@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;
@@ -117,13 +117,19 @@ public class MchManageEntity extends Model<MchManageEntity> {
@TableField(fill = FieldFill.INSERT)
@Schema(description = "创建人")
private String createBy;
/**
* 排序
*/
@Schema(description = "排序")
private Long sort;
/**
* 创建人
*/
@Schema(description = "超市类型")
private String supType;
/**
* 优惠价格(没实际作用)
*/
@@ -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> {
/**
@@ -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> {
/**
* 主键
@@ -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;
}
@@ -1,9 +0,0 @@
package com.bsd.pjcloud.wallet.api.vo.mch;
import com.bsd.pjcloud.wallet.api.entity.mch.MchDeptUserEntity;
import lombok.Data;
@Data
public class MchDeptUserVo extends MchDeptUserEntity {
}
@@ -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
@@ -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 {
}
@@ -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 {
}
@@ -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;
@@ -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();
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,116 +0,0 @@
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.log.annotation.SysLog;
import com.bsd.pjcloud.wallet.api.entity.mch.MchDeptUserEntity;
import com.bsd.pjcloud.wallet.service.MchDeptUserService;
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("/mchDeptUser" )
@Tag(description = "mchDeptUser" , name = "用户部门商户关系表管理" )
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class MchDeptUserController {
private final MchDeptUserService mchDeptUserService;
/**
* 分页查询
* @param page 分页对象
* @param mchDeptUser 用户部门商户关系表
* @return
*/
@Operation(summary = "分页查询" , description = "分页查询" )
@GetMapping("/page" )
@PreAuthorize("@pms.hasPermission('wallet_mchDeptUser_view')" )
public R getMchDeptUserPage(@ParameterObject Page page, @ParameterObject MchDeptUserEntity mchDeptUser) {
LambdaQueryWrapper<MchDeptUserEntity> wrapper = Wrappers.lambdaQuery();
return R.ok(mchDeptUserService.page(page, wrapper));
}
/**
* 通过id查询用户部门商户关系表
* @param id id
* @return R
*/
@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));
}
/**
* 新增用户部门商户关系表
* @param mchDeptUser 用户部门商户关系表
* @return R
*/
@Operation(summary = "新增用户部门商户关系表" , description = "新增用户部门商户关系表" )
@SysLog("新增用户部门商户关系表" )
@PostMapping
@PreAuthorize("@pms.hasPermission('wallet_mchDeptUser_add')" )
public R save(@RequestBody MchDeptUserEntity mchDeptUser) {
return R.ok(mchDeptUserService.save(mchDeptUser));
}
/**
* 修改用户部门商户关系表
* @param mchDeptUser 用户部门商户关系表
* @return R
*/
@Operation(summary = "修改用户部门商户关系表" , description = "修改用户部门商户关系表" )
@SysLog("修改用户部门商户关系表" )
@PutMapping
@PreAuthorize("@pms.hasPermission('wallet_mchDeptUser_edit')" )
public R updateById(@RequestBody MchDeptUserEntity mchDeptUser) {
return R.ok(mchDeptUserService.updateById(mchDeptUser));
}
/**
* 通过id删除用户部门商户关系表
* @param ids id列表
* @return R
*/
@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)));
}
/**
* 导出excel 表格
* @param mchDeptUser 查询条件
* @param ids 导出指定ID
* @return excel 文件流
*/
@ResponseExcel
@GetMapping("/export")
@PreAuthorize("@pms.hasPermission('wallet_mchDeptUser_export')" )
public List<MchDeptUserEntity> export(MchDeptUserEntity mchDeptUser,Long[] ids) {
return mchDeptUserService.list(Wrappers.lambdaQuery(mchDeptUser).in(ArrayUtil.isNotEmpty(ids), MchDeptUserEntity::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;
@@ -119,7 +119,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 +127,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,61 +26,49 @@ 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));
}
/**
* 新增商户规格配置表
*
* @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 walletRuleMchConfig) {
return R.ok(mchRuleJoinControllerService.save(walletRuleMchConfig));
}
/**
* 修改商户规格配置表
*
* @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 walletRuleMchConfig) {
return R.ok(mchRuleJoinControllerService.updateById(walletRuleMchConfig));
}
@Operation(summary = "通过id删除商户规格配置表", description = "通过id删除商户规格配置表")
@@ -88,13 +76,13 @@ public class WalletRuleMchConfigController {
@DeleteMapping
@PreAuthorize("@pms.hasPermission('dzc_walletRuleMchConfig_del')")
public R removeById(@RequestBody Long ids) {
return R.ok(walletRuleMchConfigService.removeBatchByIds(CollUtil.toList(ids)));
return R.ok(mchRuleJoinControllerService.removeBatchByIds(CollUtil.toList(ids)));
}
@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;
@@ -7,8 +7,8 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.log.annotation.SysLog;
import com.bsd.pjcloud.wallet.api.dto.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;
@@ -27,15 +27,15 @@ import java.util.List;
@RequestMapping("/wallet-rule-price-config")
@Tag(description = "wallet-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));
}
@@ -50,7 +50,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 +58,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 +74,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));
}
}
@@ -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;
@@ -46,6 +46,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,8 +63,11 @@ 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())
.like(ObjectUtil.isNotEmpty(dto.getName()), MchManageEntity::getName, dto.getName())
.in(ObjectUtil.isNotEmpty(dto.getDeptIds()), MchManageEntity::getDeptId, dto.getDeptIds())
.isNull(dto.getParentIsNull(), MchManageEntity::getParentId)
.in(ObjectUtil.isNotEmpty(dto.getIds()), MchManageEntity::getId, dto.getIds())
.orderByDesc(MchManageEntity::getSort)
.orderByDesc(MchManageEntity::getDeptId)
@@ -1,11 +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.entity.mch.MchDeptUserEntity;
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<MchDeptUserEntity> {
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);
}
@@ -3,15 +3,15 @@ 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 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<WalletRuleMchConfigEntity> {
public interface WalletRuleMchConfigMapper extends PjcloudBaseMapper<MchRuleJoinDtoEntity> {
Page<WalletRuleMchConfigVo> pageScopeList(Page page, @Param("dto") WalletRuleMchConfigDto dto, DataScope dataScope);
Page<MchRuleJoinDtoVo> pageScopeList(Page page, @Param("dto") MchRuleJoinDto dto, DataScope dataScope);
}
@@ -1,11 +1,11 @@
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 com.bsd.pjcloud.wallet.api.entity.mch.MchRulePriceConfigEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface WalletRulePriceConfigMapper extends PjcloudBaseMapper<WalletRulePriceConfigEntity> {
public interface WalletRulePriceConfigMapper extends PjcloudBaseMapper<MchRulePriceConfigEntity> {
}
@@ -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();
/**
* 分页复杂查询
*/
Page<MchDeptVo> scopeJoinPage(Page page, MchDeptDto dto, DataScope dataScope);
/**
* 复杂查询
*/
List<MchDeptVo> scopeJoinList(MchDeptDto dto, DataScope dataScope);
}
@@ -1,8 +0,0 @@
package com.bsd.pjcloud.wallet.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.bsd.pjcloud.wallet.api.entity.mch.MchDeptUserEntity;
public interface MchDeptUserService extends IService<MchDeptUserEntity> {
}
@@ -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,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.mch.MchRuleJoinDto;
import com.bsd.pjcloud.wallet.api.entity.mch.MchRuleJoinDtoEntity;
import com.bsd.pjcloud.wallet.api.vo.mch.MchRuleJoinDtoVo;
public interface MchRuleJoinControllerService extends IService<MchRuleJoinDtoEntity> {
/**
* 权限分页查询
*/
Page<MchRuleJoinDtoVo> pageScopeList(Page page, MchRuleJoinDto dto, DataScope dataScope);
}
@@ -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,21 +1,21 @@
package com.bsd.pjcloud.wallet.service;
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.wallet.api.dto.mch.MchRulePriceConfigDto;
import com.bsd.pjcloud.wallet.api.entity.mch.MchRulePriceConfigEntity;
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);
/**
* 删除
@@ -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;
@@ -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,126 @@
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.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() {
DataScope dataScope = DataScope.of();
List<SysDept> dpetList = remoteDeptService.getAllDept(null).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,13 +0,0 @@
package com.bsd.pjcloud.wallet.service.impl.mch;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bsd.pjcloud.wallet.api.entity.mch.MchDeptUserEntity;
import com.bsd.pjcloud.wallet.mapper.mch.MchDeptUserMapper;
import com.bsd.pjcloud.wallet.service.MchDeptUserService;
import org.springframework.stereotype.Service;
/**
* 用户部门商户关系表
*/
@Service
public class MchDeptUserServiceImpl extends ServiceImpl<MchDeptUserMapper, MchDeptUserEntity> implements MchDeptUserService {
}
@@ -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,11 @@ 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.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 +37,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,6 +79,9 @@ public class MchManageServiceImpl extends ServiceImpl<MchManageMapper, MchManage
return super.getById(id);
}
/**
* 新增商户管理
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Long create(MchManageEntity dto) {
@@ -86,8 +91,17 @@ public class MchManageServiceImpl extends ServiceImpl<MchManageMapper, MchManage
if (existDeptId(dto.getDeptId(), dto.getTypes(), null)) {
throw new RuntimeException("该部门已经绑定过商户");
}
if (!ObjectUtil.equals(dto.getTypes(), MerchantTypeEnum.SUPERMARKET.getType())) {
if (ObjectUtil.isNotEmpty(dto.getParentId())) {
throw new RuntimeException("改类型不能选择品牌");
}
}
if (ObjectUtil.isEmpty(dto.getMchCount())) {
dto.setMchCount(0L);
}
baseMapper.insert(dto);
getSelf().refreshQrcode(dto.getId());
updateMchCount(dto);
// walletThirdZyService.syncAllMch(dto.getId(), Boolean.FALSE);
return dto.getId();
}
@@ -101,11 +115,22 @@ 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.isNotEmpty(dto.getParentId())) {
throw new RuntimeException("改类型不能选择品牌");
}
}
MchManageEntity mchManage = getSelf().getById(dto.getId());
if (ObjectUtil.isEmpty(mchManage)) {
throw new RuntimeException("商户不存在");
}
if (ObjectUtil.equals(mchManage.getTypes(), MerchantTypeEnum.SUPERMARKET.getType())) {
if (ObjectUtil.isNotEmpty(mchManage.getMchCount()) && mchManage.getMchCount() > 0) {
throw new RuntimeException("该" + MerchantTypeEnum.SUPERMARKET.getName() + "下面有子店铺,不能修改类型");
}
}
baseMapper.updateById(dto);
updateMchCount(dto);
// walletThirdZyService.syncAllMch(dto.getId(), Boolean.FALSE);
}
@@ -136,6 +161,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)) break;
v.setChildren(list);
}
return pageList;
}
@Override
public Page<MchManageVo> scopePageList(Page page, MchManageDto dto) {
Page<MchManageVo> list = baseMapper.scopePageList(page, dto);
@@ -244,6 +286,22 @@ public class MchManageServiceImpl extends ServiceImpl<MchManageMapper, MchManage
}
}
/**
* 更新分店数量
*/
private void updateMchCount(MchManageEntity dto) {
if (ObjectUtil.isEmpty(dto) || ObjectUtil.isEmpty(dto.getParentId())) return;
Long count = baseMapper.selectCount(new LambdaQueryWrapper<MchManageEntity>()
.eq(MchManageEntity::getParentId, dto.getParentId())
);
if (ObjectUtil.isNotEmpty(count)) {
MchManageEntity updateEntity = new MchManageEntity();
updateEntity.setId(dto.getParentId());
updateEntity.setMchCount(count);
updateById(updateEntity);
}
}
private String generateMchOrder(MchManageEntity mchDetail) {
try {
MchCollectionCodeVo mchCollectionCode = new MchCollectionCodeVo();
@@ -0,0 +1,30 @@
package com.bsd.pjcloud.wallet.service.impl.mch;
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.mch.MchRuleJoinDto;
import com.bsd.pjcloud.wallet.api.entity.mch.MchRuleJoinDtoEntity;
import com.bsd.pjcloud.wallet.api.vo.mch.MchRuleJoinDtoVo;
import com.bsd.pjcloud.wallet.mapper.rule.WalletRuleMchConfigMapper;
import com.bsd.pjcloud.wallet.service.MchRuleJoinControllerService;
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 MchRuleJoinControllerServiceImpl extends ServiceImpl<WalletRuleMchConfigMapper, MchRuleJoinDtoEntity> implements MchRuleJoinControllerService {
/**
* 权限分页查询
*/
@Override
public Page<MchRuleJoinDtoVo> pageScopeList(Page page, MchRuleJoinDto dto, DataScope dataScope) {
return baseMapper.pageScopeList(page, dto, dataScope);
}
}
@@ -1,12 +1,12 @@
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.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.api.dto.mch.MchRulePriceConfigDto;
import com.bsd.pjcloud.wallet.api.entity.mch.MchRulePriceConfigEntity;
import com.bsd.pjcloud.wallet.mapper.rule.WalletRulePriceConfigMapper;
import com.bsd.pjcloud.wallet.service.WalletRulePriceConfigService;
import lombok.RequiredArgsConstructor;
@@ -20,23 +20,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 +39,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 +52,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();
@@ -83,9 +77,9 @@ public class WalletRulePriceConfigServiceImpl extends ServiceImpl<WalletRulePric
}
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 +87,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) {
@@ -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);
}
}
@@ -5,6 +5,7 @@ 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.entity.SysDept;
import com.bsd.pjcloud.admin.api.entity.SysRole;
@@ -187,9 +188,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 +206,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 +227,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 +238,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);
}
@@ -277,10 +283,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());
@@ -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>
@@ -1,18 +0,0 @@
<?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.MchDeptUserEntity">
<id property="id" column="id"/>
<result property="mchId" column="mch_id"/>
<result property="userId" column="user_id"/>
<result property="userDeptId" column="user_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>
</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"/>
@@ -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.rule.WalletRuleMchConfigMapper">
<resultMap id="walletRuleMchConfigMap" type="com.bsd.pjcloud.wallet.api.entity.rule.WalletRuleMchConfigEntity">
<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"/>
@@ -42,7 +42,7 @@
</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,
@@ -3,7 +3,7 @@
<mapper namespace="com.bsd.pjcloud.wallet.mapper.rule.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"/>