feat 增加商户相关类

This commit is contained in:
xxm1995
2023-05-19 17:27:37 +08:00
parent 95843b895c
commit 78ca6f2ebf
17 changed files with 458 additions and 26 deletions

View File

@@ -145,7 +145,8 @@
<!-- 自动建表 -->
<dependency>
<groupId>cn.bootx</groupId>
<artifactId>mybatis-table-modify</artifactId>
<artifactId>mybatis-table-modify-mysql-boot-starter</artifactId>
<version>1.5.3.alpha1</version>
</dependency>
<!-- 监控 -->

View File

@@ -0,0 +1,22 @@
package cn.bootx.platform.daxpay.core.merchant.convert;
import cn.bootx.platform.daxpay.core.merchant.entity.MchAppPayConfig;
import cn.bootx.platform.daxpay.dto.merchant.MchAppPayConfigDto;
import cn.bootx.platform.daxpay.param.merchant.MchAppPayConfigParam;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
/**
* 商户应用支付配置
* @author xxm
* @date 2023-05-19
*/
@Mapper
public interface MchAppPayConfigConvert {
MchAppPayConfigConvert CONVERT = Mappers.getMapper(MchAppPayConfigConvert.class);
MchAppPayConfig convert(MchAppPayConfigParam in);
MchAppPayConfigDto convert(MchAppPayConfig in);
}

View File

@@ -0,0 +1,22 @@
package cn.bootx.platform.daxpay.core.merchant.convert;
import cn.bootx.platform.daxpay.core.merchant.entity.MchApplication;
import cn.bootx.platform.daxpay.dto.merchant.MchApplicationDto;
import cn.bootx.platform.daxpay.param.merchant.MchApplicationParam;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
/**
* 商户应用
* @author xxm
* @date 2023-05-19
*/
@Mapper
public interface MchApplicationConvert {
MchApplicationConvert CONVERT = Mappers.getMapper(MchApplicationConvert.class);
MchApplication convert(MchApplicationParam in);
MchApplicationDto convert(MchApplication in);
}

View File

@@ -0,0 +1,33 @@
package cn.bootx.platform.daxpay.core.merchant.dao;
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
import cn.bootx.platform.daxpay.param.merchant.MchAppPayConfigParam;
import cn.bootx.platform.daxpay.core.merchant.entity.MchAppPayConfig;
import cn.bootx.platform.common.core.rest.param.PageParam;
import cn.bootx.platform.common.mybatisplus.base.MpIdEntity;
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Repository;
/**
* 商户应用支付配置
* @author xxm
* @date 2023-05-19
*/
@Repository
@RequiredArgsConstructor
public class MchAppPayConfigManager extends BaseManager<MchAppPayConfigMapper, MchAppPayConfig> {
/**
* 分页
*/
public Page<MchAppPayConfig> page(PageParam pageParam, MchAppPayConfigParam param) {
Page<MchAppPayConfig> mpPage = MpUtil.getMpPage(pageParam, MchAppPayConfig.class);
return this.lambdaQuery()
.select(this.getEntityClass(),MpUtil::excludeBigField)
.orderByDesc(MpIdEntity::getId)
.page(mpPage);
}
}

View File

@@ -0,0 +1,14 @@
package cn.bootx.platform.daxpay.core.merchant.dao;
import cn.bootx.platform.daxpay.core.merchant.entity.MchAppPayConfig;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* 商户应用支付配置
* @author xxm
* @date 2023-05-19
*/
@Mapper
public interface MchAppPayConfigMapper extends BaseMapper<MchAppPayConfig> {
}

View File

@@ -0,0 +1,33 @@
package cn.bootx.platform.daxpay.core.merchant.dao;
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
import cn.bootx.platform.daxpay.param.merchant.MchApplicationParam;
import cn.bootx.platform.daxpay.core.merchant.entity.MchApplication;
import cn.bootx.platform.common.core.rest.param.PageParam;
import cn.bootx.platform.common.mybatisplus.base.MpIdEntity;
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Repository;
/**
* 商户应用
* @author xxm
* @date 2023-05-19
*/
@Repository
@RequiredArgsConstructor
public class MchApplicationManager extends BaseManager<MchApplicationMapper, MchApplication> {
/**
* 分页
*/
public Page<MchApplication> page(PageParam pageParam, MchApplicationParam param) {
Page<MchApplication> mpPage = MpUtil.getMpPage(pageParam, MchApplication.class);
return this.lambdaQuery()
.select(this.getEntityClass(),MpUtil::excludeBigField)
.orderByDesc(MpIdEntity::getId)
.page(mpPage);
}
}

View File

@@ -0,0 +1,14 @@
package cn.bootx.platform.daxpay.core.merchant.dao;
import cn.bootx.platform.daxpay.core.merchant.entity.MchApplication;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* 商户应用
* @author xxm
* @date 2023-05-19
*/
@Mapper
public interface MchApplicationMapper extends BaseMapper<MchApplication> {
}

View File

@@ -1,27 +1,28 @@
package cn.bootx.platform.daxpay.core.merchant.entity;
import cn.bootx.mybatis.table.modify.annotation.DbColumn;
import cn.bootx.mybatis.table.modify.annotation.DbTable;
import cn.bootx.platform.common.core.function.EntityBaseFunction;
import cn.bootx.platform.common.mybatisplus.base.MpBaseEntity;
import cn.bootx.platform.daxpay.core.merchant.convert.MchAppPayConfigConvert;
import cn.bootx.platform.daxpay.dto.merchant.MchAppPayConfigDto;
import cn.bootx.platform.daxpay.param.merchant.MchAppPayConfigParam;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import lombok.experimental.FieldNameConstants;
/**
* 商户应用支付配置
* @author xxm
* @date 2023/5/17
*/
* 商户应用支付配置
* @author xxm
* @date 2023-05-19
*/
@EqualsAndHashCode(callSuper = true)
@Data
@FieldNameConstants
@Accessors(chain = true)
@DbTable(comment = "商户应用支付配置")
@TableName(value = "pay_mch_app_config")
public class MchAppPayConfig extends MpBaseEntity {
@TableName("pay_mch_app_config")
public class MchAppPayConfig extends MpBaseEntity implements EntityBaseFunction<MchAppPayConfigDto> {
/** 关联配置ID */
@DbColumn(comment = "关联配置ID")
private Long configId;
@@ -41,4 +42,14 @@ public class MchAppPayConfig extends MpBaseEntity {
@DbColumn(comment = "备注")
private String remark;
/** 创建对象 */
public static MchAppPayConfig init(MchAppPayConfigParam in) {
return MchAppPayConfigConvert.CONVERT.convert(in);
}
/** 转换成dto */
@Override
public MchAppPayConfigDto toDto() {
return MchAppPayConfigConvert.CONVERT.convert(this);
}
}

View File

@@ -1,29 +1,26 @@
package cn.bootx.platform.daxpay.core.merchant.entity;
import cn.bootx.mybatis.table.modify.annotation.DbColumn;
import cn.bootx.mybatis.table.modify.annotation.DbTable;
import cn.bootx.mybatis.table.modify.impl.mysql.annotation.MySqlIndex;
import cn.bootx.mybatis.table.modify.impl.mysql.constants.MySqlIndexType;
import cn.bootx.platform.common.core.function.EntityBaseFunction;
import cn.bootx.platform.common.mybatisplus.base.MpBaseEntity;
import cn.bootx.platform.daxpay.core.merchant.convert.MchApplicationConvert;
import cn.bootx.platform.daxpay.dto.merchant.MchApplicationDto;
import cn.bootx.platform.daxpay.param.merchant.MchApplicationParam;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import lombok.experimental.FieldNameConstants;
/**
* 商户应用
* @author xxm
* @date 2023/5/17
*/
* 商户应用
* @author xxm
* @date 2023-05-19
*/
@EqualsAndHashCode(callSuper = true)
@MySqlIndex(columns = "app_no",type = MySqlIndexType.UNIQUE,comment = "应用编码唯一索引")
@Data
@FieldNameConstants
@Accessors(chain = true)
@DbTable(comment = "商户应用")
@TableName("pay_application")
public class MchApplication extends MpBaseEntity {
public class MchApplication extends MpBaseEntity implements EntityBaseFunction<MchApplicationDto> {
/** 应用编码 */
@DbColumn(comment = "应用编码")
@@ -45,4 +42,14 @@ public class MchApplication extends MpBaseEntity {
@DbColumn(comment = "备注")
private String remark;
/** 创建对象 */
public static MchApplication init(MchApplicationParam in) {
return MchApplicationConvert.CONVERT.convert(in);
}
/** 转换成dto */
@Override
public MchApplicationDto toDto() {
return MchApplicationConvert.CONVERT.convert(this);
}
}

View File

@@ -1,8 +1,8 @@
package cn.bootx.platform.daxpay.core.merchant.entity;
import cn.bootx.mybatis.table.modify.annotation.DbColumn;
import cn.bootx.mybatis.table.modify.impl.mysql.annotation.MySqlIndex;
import cn.bootx.mybatis.table.modify.impl.mysql.constants.MySqlIndexType;
import cn.bootx.mybatis.table.modify.mybatis.mysq.annotation.MySqlIndex;
import cn.bootx.mybatis.table.modify.mybatis.mysq.constants.MySqlIndexType;
import cn.bootx.platform.common.core.function.EntityBaseFunction;
import cn.bootx.platform.common.mybatisplus.base.MpBaseEntity;
import cn.bootx.platform.daxpay.core.merchant.convert.MerchantInfoConvert;

View File

@@ -0,0 +1,75 @@
package cn.bootx.platform.daxpay.core.merchant.service;
import cn.bootx.platform.common.core.exception.DataNotExistException;
import cn.bootx.platform.common.core.rest.PageResult;
import cn.bootx.platform.common.core.rest.param.PageParam;
import cn.bootx.platform.common.core.util.ResultConvertUtil;
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
import cn.bootx.platform.daxpay.core.merchant.dao.MchAppPayConfigManager;
import cn.bootx.platform.daxpay.core.merchant.entity.MchAppPayConfig;
import cn.bootx.platform.daxpay.dto.merchant.MchAppPayConfigDto;
import cn.bootx.platform.daxpay.param.merchant.MchAppPayConfigParam;
import cn.hutool.core.bean.BeanUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 商户应用支付配置
* @author xxm
* @date 2023-05-19
*/
@Slf4j
@Service
@RequiredArgsConstructor
public class MchAppPayConfigService {
private final MchAppPayConfigManager mchAppPayConfigManager;
/**
* 添加
*/
public void add(MchAppPayConfigParam param){
MchAppPayConfig mchAppPayConfig = MchAppPayConfig.init(param);
mchAppPayConfigManager.save(mchAppPayConfig);
}
/**
* 修改
*/
public void update(MchAppPayConfigParam param){
MchAppPayConfig mchAppPayConfig = mchAppPayConfigManager.findById(param.getId()).orElseThrow(DataNotExistException::new);
BeanUtil.copyProperties(param,mchAppPayConfig, CopyOptions.create().ignoreNullValue());
mchAppPayConfigManager.updateById(mchAppPayConfig);
}
/**
* 分页
*/
public PageResult<MchAppPayConfigDto> page(PageParam pageParam,MchAppPayConfigParam mchAppPayConfigParam){
return MpUtil.convert2DtoPageResult(mchAppPayConfigManager.page(pageParam,mchAppPayConfigParam));
}
/**
* 获取单条
*/
public MchAppPayConfigDto findById(Long id){
return mchAppPayConfigManager.findById(id).map(MchAppPayConfig::toDto).orElseThrow(DataNotExistException::new);
}
/**
* 获取全部
*/
public List<MchAppPayConfigDto> findAll(){
return ResultConvertUtil.dtoListConvert(mchAppPayConfigManager.findAll());
}
/**
* 删除
*/
public void delete(Long id){
mchAppPayConfigManager.deleteById(id);
}
}

View File

@@ -0,0 +1,76 @@
package cn.bootx.platform.daxpay.core.merchant.service;
import cn.bootx.platform.common.core.exception.DataNotExistException;
import cn.bootx.platform.common.core.rest.PageResult;
import cn.bootx.platform.common.core.rest.param.PageParam;
import cn.bootx.platform.common.core.util.ResultConvertUtil;
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
import cn.bootx.platform.daxpay.core.merchant.dao.MchApplicationManager;
import cn.bootx.platform.daxpay.core.merchant.entity.MchApplication;
import cn.bootx.platform.daxpay.dto.merchant.MchApplicationDto;
import cn.bootx.platform.daxpay.param.merchant.MchApplicationParam;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 商户应用
* @author xxm
* @date 2023-05-19
*/
@Slf4j
@Service
@RequiredArgsConstructor
public class MchApplicationService {
private final MchApplicationManager mchApplicationManager;
/**
* 添加
*/
public void add(MchApplicationParam param){
MchApplication mchApplication = MchApplication.init(param);
mchApplicationManager.save(mchApplication);
}
/**
* 修改
*/
public void update(MchApplicationParam param){
MchApplication mchApplication = mchApplicationManager.findById(param.getId()).orElseThrow(DataNotExistException::new);
BeanUtil.copyProperties(param,mchApplication, CopyOptions.create().ignoreNullValue());
mchApplicationManager.updateById(mchApplication);
}
/**
* 分页
*/
public PageResult<MchApplicationDto> page(PageParam pageParam,MchApplicationParam mchApplicationParam){
return MpUtil.convert2DtoPageResult(mchApplicationManager.page(pageParam,mchApplicationParam));
}
/**
* 获取单条
*/
public MchApplicationDto findById(Long id){
return mchApplicationManager.findById(id).map(MchApplication::toDto).orElseThrow(DataNotExistException::new);
}
/**
* 获取全部
*/
public List<MchApplicationDto> findAll(){
return ResultConvertUtil.dtoListConvert(mchApplicationManager.findAll());
}
/**
* 删除
*/
public void delete(Long id){
mchApplicationManager.deleteById(id);
}
}

View File

@@ -0,0 +1,31 @@
package cn.bootx.platform.daxpay.dto.merchant;
import cn.bootx.platform.common.core.rest.dto.BaseDto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* 商户应用支付配置
* @author xxm
* @date 2023-05-19
*/
@EqualsAndHashCode(callSuper = true)
@Data
@Schema(title = "商户应用支付配置")
@Accessors(chain = true)
public class MchAppPayConfigDto extends BaseDto {
@Schema(description = "关联配置ID")
private Long configId;
@Schema(description = "支付通道类型")
private String channel;
@Schema(description = "支付通道名称")
private String channelName;
@Schema(description = "状态")
private String state;
@Schema(description = "备注")
private String remark;
}

View File

@@ -0,0 +1,31 @@
package cn.bootx.platform.daxpay.dto.merchant;
import cn.bootx.platform.common.core.rest.dto.BaseDto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* 商户应用
* @author xxm
* @date 2023-05-19
*/
@EqualsAndHashCode(callSuper = true)
@Data
@Schema(title = "商户应用")
@Accessors(chain = true)
public class MchApplicationDto extends BaseDto {
@Schema(description = "应用编码")
private String appNo;
@Schema(description = "名称")
private String name;
@Schema(description = "商户号")
private String mchNo;
@Schema(description = "状态类型")
private String state;
@Schema(description = "备注")
private String remark;
}

View File

@@ -0,0 +1,31 @@
package cn.bootx.platform.daxpay.param.merchant;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 商户应用支付配置
* @author xxm
* @date 2023-05-19
*/
@Data
@Schema(title = "商户应用支付配置")
@Accessors(chain = true)
public class MchAppPayConfigParam {
@Schema(description= "主键")
private Long id;
@Schema(description = "关联配置ID")
private Long configId;
@Schema(description = "支付通道类型")
private String channel;
@Schema(description = "支付通道名称")
private String channelName;
@Schema(description = "状态")
private String state;
@Schema(description = "备注")
private String remark;
}

View File

@@ -0,0 +1,31 @@
package cn.bootx.platform.daxpay.param.merchant;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 商户应用
* @author xxm
* @date 2023-05-19
*/
@Data
@Schema(title = "商户应用")
@Accessors(chain = true)
public class MchApplicationParam {
@Schema(description= "主键")
private Long id;
@Schema(description = "应用编码")
private String appNo;
@Schema(description = "名称")
private String name;
@Schema(description = "商户号")
private String mchNo;
@Schema(description = "状态类型")
private String state;
@Schema(description = "备注")
private String remark;
}

View File

@@ -71,7 +71,7 @@
<ding-talk.version>1.3.81</ding-talk.version>
<lock4j.version>2.2.4</lock4j.version>
<ip2region.version>2.7.0</ip2region.version>
<mybatis-table-modify.version>1.5.1.beta2</mybatis-table-modify.version>
<mybatis-table-modify.version>1.5.3.alpha1</mybatis-table-modify.version>
</properties>
<!-- 项目依赖版本管理 -->