1. 支付渠道

This commit is contained in:
邱贞招 2024-09-06 16:10:45 +08:00
parent 99ef46526b
commit a6aebd38bb
15 changed files with 1003 additions and 434 deletions

View File

@ -0,0 +1,101 @@
package com.ruoyi.web.controller.system;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.ChannelWithdraw;
import com.ruoyi.system.domain.ChannelWithdrawQuery;
import com.ruoyi.system.domain.ChannelWithdrawVO;
import com.ruoyi.system.service.ChannelWithdrawService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 提现渠道Controller
*
* @author ruoyi
* @date 2024-08-02
*/
@RestController
@RequestMapping("/ss/channelWithdraw")
public class ChannelWithdrawController extends BaseController
{
@Autowired
private ChannelWithdrawService channelWithdrawService;
/**
* 查询提现渠道列表
*/
@PreAuthorize("@ss.hasPermi('ss:channelWithdraw:list')")
@GetMapping("/list")
public TableDataInfo list(ChannelWithdrawQuery query)
{
startPage();
startOrderBy();
List<ChannelWithdrawVO> list = channelWithdrawService.selectChannelWithdrawList(query);
return getDataTable(list);
}
/**
* 导出提现渠道列表
*/
@PreAuthorize("@ss.hasPermi('ss:channelWithdraw:export')")
@Log(title = "提现渠道", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ChannelWithdrawQuery query)
{
List<ChannelWithdrawVO> list = channelWithdrawService.selectChannelWithdrawList(query);
ExcelUtil<ChannelWithdrawVO> util = new ExcelUtil<ChannelWithdrawVO>(ChannelWithdrawVO.class);
util.exportExcel(response, list, "提现渠道数据");
}
/**
* 获取提现渠道详细信息
*/
@PreAuthorize("@ss.hasPermi('ss:channelWithdraw:query')")
@GetMapping(value = "/{channelId}")
public AjaxResult getInfo(@PathVariable("channelId") Long channelId)
{
return success(channelWithdrawService.selectChannelWithdrawByChannelId(channelId));
}
/**
* 新增提现渠道
*/
@PreAuthorize("@ss.hasPermi('ss:channelWithdraw:add')")
@Log(title = "提现渠道", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ChannelWithdraw channelWithdraw)
{
return toAjax(channelWithdrawService.insertChannelWithdraw(channelWithdraw));
}
/**
* 修改提现渠道
*/
@PreAuthorize("@ss.hasPermi('ss:channelWithdraw:edit')")
@Log(title = "提现渠道", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ChannelWithdraw channelWithdraw)
{
return toAjax(channelWithdrawService.updateChannelWithdraw(channelWithdraw));
}
/**
* 删除提现渠道
*/
@PreAuthorize("@ss.hasPermi('ss:channelWithdraw:remove')")
@Log(title = "提现渠道", businessType = BusinessType.DELETE)
@DeleteMapping("/{channelIds}")
public AjaxResult remove(@PathVariable Long[] channelIds)
{
return toAjax(channelWithdrawService.deleteChannelWithdrawByChannelIds(channelIds));
}
}

View File

@ -1,88 +1,86 @@
//package com.ruoyi.web.controller.system;
//
//import com.ruoyi.common.annotation.Log;
//import com.ruoyi.common.core.controller.BaseController;
//import com.ruoyi.common.core.domain.AjaxResult;
//import com.ruoyi.common.core.domain.ValidGroup;
//import com.ruoyi.common.core.page.TableDataInfo;
//import com.ruoyi.common.enums.BusinessType;
//import com.ruoyi.common.utils.poi.ExcelUtil;
//import com.ruoyi.ss.channel.domain.Channel;
//import com.ruoyi.ss.channel.domain.ChannelQuery;
//import com.ruoyi.ss.channel.domain.ChannelVO;
//import com.ruoyi.ss.channel.service.ChannelService;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.security.access.prepost.PreAuthorize;
//import org.springframework.validation.annotation.Validated;
//import org.springframework.web.bind.annotation.*;
//
//import javax.servlet.http.HttpServletResponse;
//import java.util.List;
//
///**
// * 充值渠道Controller
// *
// * @author ruoyi
// * @date 2024-04-15
// */
//@RestController
//@RequestMapping("/system/channel")
//public class SmChannelController extends BaseController
//{
// @Autowired
// private ChannelService smChannelService;
//
// /**
// * 查询充值渠道列表
// */
// @PreAuthorize("@ss.hasPermi('system:channel:list')")
// @GetMapping("/list")
// public TableDataInfo list(ChannelQuery smChannel)
// {
// startPage();
// List<ChannelVO> list = smChannelService.selectSmChannelList(smChannel);
// return getDataTable(list);
// }
//
// /**
// * 导出充值渠道列表
// */
// @PreAuthorize("@ss.hasPermi('system:channel:export')")
// @Log(title = "充值渠道", businessType = BusinessType.EXPORT)
// @PostMapping("/export")
// public void export(HttpServletResponse response, ChannelQuery smChannel)
// {
// List<ChannelVO> list = smChannelService.selectSmChannelList(smChannel);
// ExcelUtil<ChannelVO> util = new ExcelUtil<ChannelVO>(ChannelVO.class);
// util.exportExcel(response, list, "充值渠道数据");
// }
//
// /**
// * 获取充值渠道详细信息
// */
// @PreAuthorize("@ss.hasPermi('system:channel:query')")
// @GetMapping(value = "/{channelId}")
// public AjaxResult getInfo(@PathVariable("channelId") Long channelId)
// {
// return success(smChannelService.selectSmChannelByChannelId(channelId));
// }
//
// /**
// * 修改充值渠道
// */
// @PreAuthorize("@ss.hasPermi('system:channel:edit')")
// @Log(title = "充值渠道", businessType = BusinessType.UPDATE)
// @PutMapping
// public AjaxResult edit(@RequestBody @Validated(ValidGroup.Update.class) Channel form)
// {
// Channel channel = new Channel();
// channel.setChannelId(form.getChannelId());
// channel.setEnabled(form.getEnabled());
// channel.setServiceRate(form.getServiceRate());
// channel.setCostRate(form.getCostRate());
// channel.setServiceType(form.getServiceType());
// channel.setPicture(form.getPicture());
// return toAjax(smChannelService.updateSmChannel(channel));
// }
//
//}
package com.ruoyi.web.controller.system;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.ValidGroup;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.Channel;
import com.ruoyi.system.domain.ChannelQuery;
import com.ruoyi.system.domain.ChannelVO;
import com.ruoyi.system.service.ChannelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 充值渠道Controller
*
* @author ruoyi
* @date 2024-04-15
*/
@RestController
@RequestMapping("/system/channel")
public class SmChannelController extends BaseController
{
@Autowired
private ChannelService smChannelService;
/**
* 查询充值渠道列表
*/
@PreAuthorize("@ss.hasPermi('system:channel:list')")
@GetMapping("/list")
public TableDataInfo list(ChannelQuery smChannel)
{
startPage();
List<ChannelVO> list = smChannelService.selectSmChannelList(smChannel);
return getDataTable(list);
}
/**
* 导出充值渠道列表
*/
@PreAuthorize("@ss.hasPermi('system:channel:export')")
@Log(title = "充值渠道", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ChannelQuery smChannel)
{
List<ChannelVO> list = smChannelService.selectSmChannelList(smChannel);
ExcelUtil<ChannelVO> util = new ExcelUtil<ChannelVO>(ChannelVO.class);
util.exportExcel(response, list, "充值渠道数据");
}
/**
* 获取充值渠道详细信息
*/
@PreAuthorize("@ss.hasPermi('system:channel:query')")
@GetMapping(value = "/{channelId}")
public AjaxResult getInfo(@PathVariable("channelId") Long channelId)
{
return success(smChannelService.selectSmChannelByChannelId(channelId));
}
/**
* 修改充值渠道
*/
@PreAuthorize("@ss.hasPermi('system:channel:edit')")
@Log(title = "充值渠道", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody @Validated(ValidGroup.Update.class) Channel form)
{
Channel channel = new Channel();
channel.setChannelId(form.getChannelId());
channel.setEnabled(form.getEnabled());
channel.setCostRate(form.getCostRate());
channel.setPicture(form.getPicture());
return toAjax(smChannelService.updateSmChannel(channel));
}
}

View File

@ -3,7 +3,7 @@ package com.ruoyi.system.domain;
import com.fasterxml.jackson.annotation.JsonView;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.core.domain.JsonViewProfile;
//import com.ruoyi.common.core.domain.JsonViewProfile;
import com.ruoyi.common.core.domain.ValidGroup;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -23,34 +23,34 @@ public class Channel extends BaseEntity
private static final long serialVersionUID = 1L;
/** 主键 */
@JsonView(JsonViewProfile.App.class)
// @JsonView(JsonViewProfile.App.class)
private Long channelId;
/** 渠道名称 */
@Excel(name = "渠道名称")
@JsonView(JsonViewProfile.App.class)
// @JsonView(JsonViewProfile.App.class)
private String name;
/** 是否启用 */
@Excel(name = "是否启用")
private Boolean enabled;
/** 服务费费率% */
@Excel(name = "服务费费率%")
@Min(value = 0, message = "服务费费率不允许低于0", groups = {ValidGroup.Update.class})
private BigDecimal serviceRate;
// /** 服务费费率% */
// @Excel(name = "服务费费率%")
// @Min(value = 0, message = "服务费费率不允许低于0", groups = {ValidGroup.Update.class})
// private BigDecimal serviceRate;
/** 成本率% */
@Excel(name = "成本率%")
@Min(value = 0, message = "成本率不允许低于0", groups = {ValidGroup.Update.class})
private BigDecimal costRate;
@Excel(name = "服务费类型")
@ApiModelProperty("服务费类型")
private String serviceType;
// @Excel(name = "服务费类型")
// @ApiModelProperty("服务费类型")
// private String serviceType;
@ApiModelProperty("渠道图片")
@JsonView(JsonViewProfile.App.class)
// @JsonView(JsonViewProfile.App.class)
private String picture;
}

View File

@ -0,0 +1,60 @@
package com.ruoyi.system.domain;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Min;
import java.math.BigDecimal;
/**
* 提现渠道对象 ss_channel_withdraw
*
* @author ruoyi
* @date 2024-08-02
*/
@Data
public class ChannelWithdraw extends BaseEntity
{
private static final long serialVersionUID = 1L;
private Long channelId;
@Excel(name = "渠道名称")
@ApiModelProperty("渠道名称")
private String name;
@Excel(name = "对应账户类型")
@ApiModelProperty("对应账户类型")
private String accountType;
@Excel(name = "服务费收取类型")
@ApiModelProperty("服务费收取类型")
private String serviceType;
@Excel(name = "服务费")
@ApiModelProperty("服务费")
private BigDecimal serviceRate;
@Excel(name = "是否启用")
@ApiModelProperty("是否启用")
private Boolean enabled;
@Excel(name = "渠道成本率")
@ApiModelProperty("渠道成本率")
private BigDecimal costRate;
@Excel(name = "图片")
@ApiModelProperty("图片")
private String picture;
@ApiModelProperty("单笔最低提现金额")
@Min(value = 0, message = "单笔最低提现金额不能小于0")
private BigDecimal minAmount;
@ApiModelProperty("单笔最高提现金额")
@Min(value = 0, message = "单笔最高提现金额不能小于0")
private BigDecimal maxAmount;
}

View File

@ -0,0 +1,18 @@
package com.ruoyi.system.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author wjh
* 2024/8/2
*/
@Data
public class ChannelWithdrawQuery extends ChannelWithdraw{
@ApiModelProperty("账户类型列表")
private List<String> accountTypes;
}

View File

@ -0,0 +1,11 @@
package com.ruoyi.system.domain;
import lombok.Data;
/**
* @author wjh
* 2024/8/2
*/
@Data
public class ChannelWithdrawVO extends ChannelWithdraw{
}

View File

@ -1,9 +1,9 @@
package com.ruoyi.system.mapper;
//import com.ruoyi.ss.channel.domain.Channel;
//import com.ruoyi.ss.channel.domain.ChannelQuery;
//import com.ruoyi.ss.channel.domain.ChannelVO;
//import org.apache.ibatis.annotations.Param;
import com.ruoyi.system.domain.Channel;
import com.ruoyi.system.domain.ChannelQuery;
import com.ruoyi.system.domain.ChannelVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -15,51 +15,51 @@ import java.util.List;
*/
public interface ChannelMapper
{
// /**
// * 查询充值渠道
// *
// * @param channelId 充值渠道主键
// * @return 充值渠道
// */
// public ChannelVO selectSmChannelByChannelId(Long channelId);
//
// /**
// * 查询充值渠道列表
// *
// * @param smChannel 充值渠道
// * @return 充值渠道集合
// */
// public List<ChannelVO> selectSmChannelList(@Param("query") ChannelQuery smChannel);
//
// /**
// * 新增充值渠道
// *
// * @param channel 充值渠道
// * @return 结果
// */
// public int insertSmChannel(Channel channel);
//
// /**
// * 修改充值渠道
// *
// * @param channel 充值渠道
// * @return 结果
// */
// public int updateSmChannel(@Param("data") Channel channel);
//
// /**
// * 删除充值渠道
// *
// * @param channelId 充值渠道主键
// * @return 结果
// */
// public int deleteSmChannelByChannelId(Long channelId);
//
// /**
// * 批量删除充值渠道
// *
// * @param channelIds 需要删除的数据主键集合
// * @return 结果
// */
// public int deleteSmChannelByChannelIds(Long[] channelIds);
/**
* 查询充值渠道
*
* @param channelId 充值渠道主键
* @return 充值渠道
*/
public ChannelVO selectSmChannelByChannelId(Long channelId);
/**
* 查询充值渠道列表
*
* @param smChannel 充值渠道
* @return 充值渠道集合
*/
public List<ChannelVO> selectSmChannelList(@Param("query") ChannelQuery smChannel);
/**
* 新增充值渠道
*
* @param channel 充值渠道
* @return 结果
*/
public int insertSmChannel(Channel channel);
/**
* 修改充值渠道
*
* @param channel 充值渠道
* @return 结果
*/
public int updateSmChannel(@Param("data") Channel channel);
/**
* 删除充值渠道
*
* @param channelId 充值渠道主键
* @return 结果
*/
public int deleteSmChannelByChannelId(Long channelId);
/**
* 批量删除充值渠道
*
* @param channelIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteSmChannelByChannelIds(Long[] channelIds);
}

View File

@ -0,0 +1,65 @@
package com.ruoyi.system.mapper;
import com.ruoyi.system.domain.ChannelWithdraw;
import com.ruoyi.system.domain.ChannelWithdrawQuery;
import com.ruoyi.system.domain.ChannelWithdrawVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 提现渠道Mapper接口
*
* @author ruoyi
* @date 2024-08-02
*/
public interface ChannelWithdrawMapper
{
/**
* 查询提现渠道
*
* @param channelId 提现渠道主键
* @return 提现渠道
*/
public ChannelWithdrawVO selectChannelWithdrawByChannelId(Long channelId);
/**
* 查询提现渠道列表
*
* @param query 提现渠道
* @return 提现渠道集合
*/
public List<ChannelWithdrawVO> selectChannelWithdrawList(@Param("query") ChannelWithdrawQuery query);
/**
* 新增提现渠道
*
* @param channelWithdraw 提现渠道
* @return 结果
*/
public int insertChannelWithdraw(ChannelWithdraw channelWithdraw);
/**
* 修改提现渠道
*
* @param channelWithdraw 提现渠道
* @return 结果
*/
public int updateChannelWithdraw(@Param("data") ChannelWithdraw channelWithdraw);
/**
* 删除提现渠道
*
* @param channelId 提现渠道主键
* @return 结果
*/
public int deleteChannelWithdrawByChannelId(Long channelId);
/**
* 批量删除提现渠道
*
* @param channelIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteChannelWithdrawByChannelIds(Long[] channelIds);
}

View File

@ -0,0 +1,43 @@
package com.ruoyi.system.mapper.typehandler;
import org.apache.ibatis.type.BaseTypeHandler;
import org.apache.ibatis.type.JdbcType;
import java.math.BigDecimal;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
* 非空BigDecimal类型处理器为空时返回0
* @author wjh
* 2024/3/30
*/
public class NonNullDecimalTypeHandler extends BaseTypeHandler<BigDecimal> {
@Override
public void setNonNullParameter(PreparedStatement ps, int i, BigDecimal parameter, JdbcType jdbcType) throws SQLException {
ps.setBigDecimal(i, parameter);
}
@Override
public BigDecimal getNullableResult(ResultSet rs, String columnName)
throws SQLException {
BigDecimal data = rs.getBigDecimal(columnName);
return data == null ? BigDecimal.ZERO : data;
}
@Override
public BigDecimal getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
BigDecimal data = rs.getBigDecimal(columnIndex);
return data == null ? BigDecimal.ZERO : data;
}
@Override
public BigDecimal getNullableResult(CallableStatement cs, int columnIndex)
throws SQLException {
BigDecimal data = cs.getBigDecimal(columnIndex);
return data == null ? BigDecimal.ZERO : data;
}
}

View File

@ -1,82 +1,82 @@
//package com.ruoyi.system.service;
//
//import com.ruoyi.ss.channel.domain.Channel;
//import com.ruoyi.ss.channel.domain.ChannelQuery;
//import com.ruoyi.ss.channel.domain.ChannelVO;
//
//import java.util.List;
//import java.util.Map;
//import java.util.function.Function;
//
///**
// * 充值渠道Service接口
// *
// * @author ruoyi
// * @date 2024-04-15
// */
//public interface ChannelService
//{
// /**
// * 查询充值渠道
// *
// * @param channelId 充值渠道主键
// * @return 充值渠道
// */
// public ChannelVO selectSmChannelByChannelId(Long channelId);
//
// /**
// * 查询充值渠道列表
// *
// * @param smChannel 充值渠道
// * @return 充值渠道集合
// */
// public List<ChannelVO> selectSmChannelList(ChannelQuery smChannel);
//
// /**
// * 新增充值渠道
// *
// * @param channel 充值渠道
// * @return 结果
// */
// public int insertSmChannel(Channel channel);
//
// /**
// * 修改充值渠道
// *
// * @param channel 充值渠道
// * @return 结果
// */
// public int updateSmChannel(Channel channel);
//
// /**
// * 批量删除充值渠道
// *
// * @param channelIds 需要删除的充值渠道主键集合
// * @return 结果
// */
// public int deleteSmChannelByChannelIds(Long[] channelIds);
//
// /**
// * 删除充值渠道信息
// *
// * @param channelId 充值渠道主键
// * @return 结果
// */
// public int deleteSmChannelByChannelId(Long channelId);
//
// /**
// * 查询启用的充值渠道列表
// *
// * @return
// */
// List<ChannelVO> selectEnabledRechargeList();
//
// /**
// * 查询充值渠道映射表
// *
// * @param query 查询条件
// * @param keyMapper 映射函数
// */
// <K> Map<K, ChannelVO> selectMap(ChannelQuery query, Function<? super Channel, ? extends K> keyMapper);
//
//}
package com.ruoyi.system.service;
import com.ruoyi.system.domain.Channel;
import com.ruoyi.system.domain.ChannelQuery;
import com.ruoyi.system.domain.ChannelVO;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
/**
* 充值渠道Service接口
*
* @author ruoyi
* @date 2024-04-15
*/
public interface ChannelService
{
/**
* 查询充值渠道
*
* @param channelId 充值渠道主键
* @return 充值渠道
*/
public ChannelVO selectSmChannelByChannelId(Long channelId);
/**
* 查询充值渠道列表
*
* @param smChannel 充值渠道
* @return 充值渠道集合
*/
public List<ChannelVO> selectSmChannelList(ChannelQuery smChannel);
/**
* 新增充值渠道
*
* @param channel 充值渠道
* @return 结果
*/
public int insertSmChannel(Channel channel);
/**
* 修改充值渠道
*
* @param channel 充值渠道
* @return 结果
*/
public int updateSmChannel(Channel channel);
/**
* 批量删除充值渠道
*
* @param channelIds 需要删除的充值渠道主键集合
* @return 结果
*/
public int deleteSmChannelByChannelIds(Long[] channelIds);
/**
* 删除充值渠道信息
*
* @param channelId 充值渠道主键
* @return 结果
*/
public int deleteSmChannelByChannelId(Long channelId);
/**
* 查询启用的充值渠道列表
*
* @return
*/
List<ChannelVO> selectEnabledRechargeList();
/**
* 查询充值渠道映射表
*
* @param query 查询条件
* @param keyMapper 映射函数
*/
<K> Map<K, ChannelVO> selectMap(ChannelQuery query, Function<? super Channel, ? extends K> keyMapper);
}

View File

@ -0,0 +1,69 @@
package com.ruoyi.system.service;
import com.ruoyi.system.domain.ChannelWithdraw;
import com.ruoyi.system.domain.ChannelWithdrawQuery;
import com.ruoyi.system.domain.ChannelWithdrawVO;
import java.util.List;
/**
* 提现渠道Service接口
*
* @author ruoyi
* @date 2024-08-02
*/
public interface ChannelWithdrawService
{
/**
* 查询提现渠道
*
* @param channelId 提现渠道主键
* @return 提现渠道
*/
public ChannelWithdrawVO selectChannelWithdrawByChannelId(Long channelId);
/**
* 查询提现渠道列表
*
* @param channelWithdraw 提现渠道
* @return 提现渠道集合
*/
public List<ChannelWithdrawVO> selectChannelWithdrawList(ChannelWithdrawQuery channelWithdraw);
/**
* 新增提现渠道
*
* @param channelWithdraw 提现渠道
* @return 结果
*/
public int insertChannelWithdraw(ChannelWithdraw channelWithdraw);
/**
* 修改提现渠道
*
* @param channelWithdraw 提现渠道
* @return 结果
*/
public int updateChannelWithdraw(ChannelWithdraw channelWithdraw);
/**
* 批量删除提现渠道
*
* @param channelIds 需要删除的提现渠道主键集合
* @return 结果
*/
public int deleteChannelWithdrawByChannelIds(Long[] channelIds);
/**
* 删除提现渠道信息
*
* @param channelId 提现渠道主键
* @return 结果
*/
public int deleteChannelWithdrawByChannelId(Long channelId);
/**
* 查询用户可用的提现渠道
*/
List<ChannelWithdrawVO> selectEnabledList(Long userId);
}

View File

@ -1,127 +1,122 @@
//package com.ruoyi.system.service.impl;
//
//import com.ruoyi.common.utils.collection.CollectionUtils;
//import com.ruoyi.ss.account.service.AccountService;
//import com.ruoyi.ss.channel.domain.Channel;
//import com.ruoyi.ss.channel.domain.ChannelQuery;
//import com.ruoyi.ss.channel.domain.ChannelVO;
//import com.ruoyi.ss.channel.mapper.ChannelMapper;
//import com.ruoyi.ss.channel.service.ChannelService;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//
//import java.util.Collections;
//import java.util.List;
//import java.util.Map;
//import java.util.function.Function;
//import java.util.stream.Collectors;
//
///**
// * 充值渠道Service业务层处理
// *
// * @author ruoyi
// * @date 2024-04-15
// */
//@Service
//public class ChannelServiceImpl implements ChannelService
//{
// @Autowired
// private ChannelMapper channelMapper;
//
// @Autowired
// private AccountService accountService;
//
// /**
// * 查询充值渠道
// *
// * @param channelId 充值渠道主键
// * @return 充值渠道
// */
// @Override
// public ChannelVO selectSmChannelByChannelId(Long channelId)
// {
// return channelMapper.selectSmChannelByChannelId(channelId);
// }
//
// /**
// * 查询充值渠道列表
// *
// * @param smChannel 充值渠道
// * @return 充值渠道
// */
// @Override
// public List<ChannelVO> selectSmChannelList(ChannelQuery smChannel)
// {
// return channelMapper.selectSmChannelList(smChannel);
// }
//
// /**
// * 新增充值渠道
// *
// * @param channel 充值渠道
// * @return 结果
// */
// @Override
// public int insertSmChannel(Channel channel)
// {
// return channelMapper.insertSmChannel(channel);
// }
//
// /**
// * 修改充值渠道
// *
// * @param channel 充值渠道
// * @return 结果
// */
// @Override
// public int updateSmChannel(Channel channel)
// {
// return channelMapper.updateSmChannel(channel);
// }
//
// /**
// * 批量删除充值渠道
// *
// * @param channelIds 需要删除的充值渠道主键
// * @return 结果
// */
// @Override
// public int deleteSmChannelByChannelIds(Long[] channelIds)
// {
// return channelMapper.deleteSmChannelByChannelIds(channelIds);
// }
//
// /**
// * 删除充值渠道信息
// *
// * @param channelId 充值渠道主键
// * @return 结果
// */
// @Override
// public int deleteSmChannelByChannelId(Long channelId)
// {
// return channelMapper.deleteSmChannelByChannelId(channelId);
// }
//
// @Override
// public List<ChannelVO> selectEnabledRechargeList() {
// ChannelQuery dto = new ChannelQuery();
// dto.setEnabled(true);
// return this.selectSmChannelList(dto);
// }
//
// /**
// * 查询充值渠道映射表
// *
// * @param query 查询条件
// * @param keyMapper 映射函数
// */
// @Override
// public <K> Map<K, ChannelVO> selectMap(ChannelQuery query, Function<? super Channel, ? extends K> keyMapper) {
// List<ChannelVO> list = this.selectSmChannelList(query);
package com.ruoyi.system.service.impl;
import com.ruoyi.system.domain.Channel;
import com.ruoyi.system.domain.ChannelQuery;
import com.ruoyi.system.domain.ChannelVO;
import com.ruoyi.system.mapper.ChannelMapper;
import com.ruoyi.system.service.ChannelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* 充值渠道Service业务层处理
*
* @author ruoyi
* @date 2024-04-15
*/
@Service
public class ChannelServiceImpl implements ChannelService
{
@Resource
private ChannelMapper channelMapper;
/**
* 查询充值渠道
*
* @param channelId 充值渠道主键
* @return 充值渠道
*/
@Override
public ChannelVO selectSmChannelByChannelId(Long channelId)
{
return channelMapper.selectSmChannelByChannelId(channelId);
}
/**
* 查询充值渠道列表
*
* @param smChannel 充值渠道
* @return 充值渠道
*/
@Override
public List<ChannelVO> selectSmChannelList(ChannelQuery smChannel)
{
return channelMapper.selectSmChannelList(smChannel);
}
/**
* 新增充值渠道
*
* @param channel 充值渠道
* @return 结果
*/
@Override
public int insertSmChannel(Channel channel)
{
return channelMapper.insertSmChannel(channel);
}
/**
* 修改充值渠道
*
* @param channel 充值渠道
* @return 结果
*/
@Override
public int updateSmChannel(Channel channel)
{
return channelMapper.updateSmChannel(channel);
}
/**
* 批量删除充值渠道
*
* @param channelIds 需要删除的充值渠道主键
* @return 结果
*/
@Override
public int deleteSmChannelByChannelIds(Long[] channelIds)
{
return channelMapper.deleteSmChannelByChannelIds(channelIds);
}
/**
* 删除充值渠道信息
*
* @param channelId 充值渠道主键
* @return 结果
*/
@Override
public int deleteSmChannelByChannelId(Long channelId)
{
return channelMapper.deleteSmChannelByChannelId(channelId);
}
@Override
public List<ChannelVO> selectEnabledRechargeList() {
ChannelQuery dto = new ChannelQuery();
dto.setEnabled(true);
return this.selectSmChannelList(dto);
}
/**
* 查询充值渠道映射表
*
* @param query 查询条件
* @param keyMapper 映射函数
*/
@Override
public <K> Map<K, ChannelVO> selectMap(ChannelQuery query, Function<? super Channel, ? extends K> keyMapper) {
List<ChannelVO> list = this.selectSmChannelList(query);
// if (CollectionUtils.isEmptyElement(list)) {
// return Collections.emptyMap();
// }
// return list.stream().collect(Collectors.toMap(keyMapper, item -> item));
// }
//}
return list.stream().collect(Collectors.toMap(keyMapper, item -> item));
}
}

View File

@ -0,0 +1,114 @@
package com.ruoyi.system.service.impl;
import com.ruoyi.system.domain.ChannelWithdraw;
import com.ruoyi.system.domain.ChannelWithdrawQuery;
import com.ruoyi.system.domain.ChannelWithdrawVO;
import com.ruoyi.system.mapper.ChannelWithdrawMapper;
import com.ruoyi.system.service.ChannelWithdrawService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 提现渠道Service业务层处理
*
* @author ruoyi
* @date 2024-08-02
*/
@Service
public class ChannelWithdrawServiceImpl implements ChannelWithdrawService
{
@Resource
private ChannelWithdrawMapper channelWithdrawMapper;
// @Autowired
// private AccountService accountService;
/**
* 查询提现渠道
*
* @param channelId 提现渠道主键
* @return 提现渠道
*/
@Override
public ChannelWithdrawVO selectChannelWithdrawByChannelId(Long channelId)
{
return channelWithdrawMapper.selectChannelWithdrawByChannelId(channelId);
}
/**
* 查询提现渠道列表
*
* @param channelWithdraw 提现渠道
* @return 提现渠道
*/
@Override
public List<ChannelWithdrawVO> selectChannelWithdrawList(ChannelWithdrawQuery channelWithdraw)
{
return channelWithdrawMapper.selectChannelWithdrawList(channelWithdraw);
}
/**
* 新增提现渠道
*
* @param channelWithdraw 提现渠道
* @return 结果
*/
@Override
public int insertChannelWithdraw(ChannelWithdraw channelWithdraw)
{
return channelWithdrawMapper.insertChannelWithdraw(channelWithdraw);
}
/**
* 修改提现渠道
*
* @param channelWithdraw 提现渠道
* @return 结果
*/
@Override
public int updateChannelWithdraw(ChannelWithdraw channelWithdraw)
{
return channelWithdrawMapper.updateChannelWithdraw(channelWithdraw);
}
/**
* 批量删除提现渠道
*
* @param channelIds 需要删除的提现渠道主键
* @return 结果
*/
@Override
public int deleteChannelWithdrawByChannelIds(Long[] channelIds)
{
return channelWithdrawMapper.deleteChannelWithdrawByChannelIds(channelIds);
}
/**
* 删除提现渠道信息
*
* @param channelId 提现渠道主键
* @return 结果
*/
@Override
public int deleteChannelWithdrawByChannelId(Long channelId)
{
return channelWithdrawMapper.deleteChannelWithdrawByChannelId(channelId);
}
@Override
public List<ChannelWithdrawVO> selectEnabledList(Long userId) {
// 查询用户账户列表
// List<AccountVO> accountList = accountService.selectByUserId(userId);
// if (CollectionUtils.isEmptyElement(accountList)) {
// return Collections.emptyList();
// }
// 查询渠道列表
// ChannelWithdrawQuery query = new ChannelWithdrawQuery();
// query.setAccountTypes(CollectionUtils.map(accountList, AccountVO::getAccountType));
// query.setEnabled(true);
// return this.selectChannelWithdrawList(query);
return null;
}
}

View File

@ -4,90 +4,80 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.ChannelMapper">
<!-- <resultMap type="ChannelVO" id="SmChannelResult" autoMapping="true">-->
<!-- <result property="serviceRate" column="service_rate" typeHandler="com.ruoyi.system.mapper.typehandler.NonNullDecimalTypeHandler"/>-->
<!-- <result property="costRate" column="cost_rate" typeHandler="com.ruoyi.system.mapper.typehandler.NonNullDecimalTypeHandler"/>-->
<!-- </resultMap>-->
<resultMap type="ChannelVO" id="SmChannelResult" autoMapping="true">
<result property="costRate" column="cost_rate" typeHandler="com.ruoyi.system.mapper.typehandler.NonNullDecimalTypeHandler"/>
</resultMap>
<!-- <sql id="selectSmChannelVo">-->
<!-- select-->
<!-- sc.channel_id,-->
<!-- sc.name,-->
<!-- sc.enabled,-->
<!-- sc.service_rate,-->
<!-- sc.cost_rate,-->
<!-- sc.service_type,-->
<!-- sc.picture-->
<!-- from sm_channel sc-->
<!-- </sql>-->
<sql id="selectSmChannelVo">
select
sc.channel_id,
sc.name,
sc.enabled,
sc.cost_rate,
sc.picture
from sm_channel sc
</sql>
<!-- <sql id="searchCondition">-->
<!-- <if test="query.name != null and query.name != ''"> and sc.name like concat('%', #{query.name}, '%')</if>-->
<!-- <if test="query.enabled != null "> and sc.enabled = #{query.enabled}</if>-->
<!-- <if test="query.serviceType != null and query.serviceType != ''"> and sc.service_type = #{query.serviceType}</if>-->
<!-- <if test="query.channelIds != null and query.channelIds.size() > 0 ">-->
<!-- and sc.channel_id in-->
<!-- <foreach item="item" collection="query.channelIds" open="(" separator="," close=")">-->
<!-- #{item}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- </sql>-->
<sql id="searchCondition">
<if test="query.name != null and query.name != ''"> and sc.name like concat('%', #{query.name}, '%')</if>
<if test="query.enabled != null "> and sc.enabled = #{query.enabled}</if>
<if test="query.channelIds != null and query.channelIds.size() > 0 ">
and sc.channel_id in
<foreach item="item" collection="query.channelIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</sql>
<!-- <select id="selectSmChannelList" parameterType="ChannelQuery" resultMap="SmChannelResult">-->
<!-- <include refid="selectSmChannelVo"/>-->
<!-- <where>-->
<!-- <include refid="searchCondition"/>-->
<!-- </where>-->
<!-- </select>-->
<select id="selectSmChannelList" parameterType="ChannelQuery" resultMap="SmChannelResult">
<include refid="selectSmChannelVo"/>
<where>
<include refid="searchCondition"/>
</where>
</select>
<!-- <select id="selectSmChannelByChannelId" parameterType="Long" resultMap="SmChannelResult">-->
<!-- <include refid="selectSmChannelVo"/>-->
<!-- where sc.channel_id = #{channelId}-->
<!-- </select>-->
<select id="selectSmChannelByChannelId" parameterType="Long" resultMap="SmChannelResult">
<include refid="selectSmChannelVo"/>
where sc.channel_id = #{channelId}
</select>
<!-- <insert id="insertSmChannel" parameterType="Channel">-->
<!-- insert into sm_channel-->
<!-- <trim prefix="(" suffix=")" suffixOverrides=",">-->
<!-- <if test="channelId != null">channel_id,</if>-->
<!-- <if test="name != null">`name`,</if>-->
<!-- <if test="enabled != null">enabled,</if>-->
<!-- <if test="serviceRate != null">service_rate,</if>-->
<!-- <if test="costRate != null">cost_rate,</if>-->
<!-- <if test="serviceType != null">service_type,</if>-->
<!-- <if test="picture != null">picture,</if>-->
<!-- </trim>-->
<!-- <trim prefix="values (" suffix=")" suffixOverrides=",">-->
<!-- <if test="channelId != null">#{channelId},</if>-->
<!-- <if test="name != null">#{name},</if>-->
<!-- <if test="enabled != null">#{enabled},</if>-->
<!-- <if test="serviceRate != null">#{serviceRate},</if>-->
<!-- <if test="costRate != null">#{costRate},</if>-->
<!-- <if test="serviceType != null">#{serviceType},</if>-->
<!-- <if test="picture != null">#{picture},</if>-->
<!-- </trim>-->
<!-- </insert>-->
<insert id="insertSmChannel" parameterType="Channel">
insert into sm_channel
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="channelId != null">channel_id,</if>
<if test="name != null">`name`,</if>
<if test="enabled != null">enabled,</if>
<if test="costRate != null">cost_rate,</if>
<if test="picture != null">picture,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="channelId != null">#{channelId},</if>
<if test="name != null">#{name},</if>
<if test="enabled != null">#{enabled},</if>
<if test="costRate != null">#{costRate},</if>
<if test="picture != null">#{picture},</if>
</trim>
</insert>
<!-- <update id="updateSmChannel" parameterType="Channel">-->
<!-- update sm_channel-->
<!-- <trim prefix="SET" suffixOverrides=",">-->
<!-- <if test="data.name != null">name = #{data.name},</if>-->
<!-- <if test="data.enabled != null">enabled = #{data.enabled},</if>-->
<!-- <if test="data.serviceRate != null">service_rate = #{data.serviceRate},</if>-->
<!-- <if test="data.costRate != null">cost_rate = #{data.costRate},</if>-->
<!-- <if test="data.serviceType != null">service_type = #{data.serviceType},</if>-->
<!-- <if test="data.picture != null">picture = #{data.picture},</if>-->
<!-- </trim>-->
<!-- where channel_id = #{data.channelId}-->
<!-- </update>-->
<update id="updateSmChannel" parameterType="Channel">
update sm_channel
<trim prefix="SET" suffixOverrides=",">
<if test="data.name != null">name = #{data.name},</if>
<if test="data.enabled != null">enabled = #{data.enabled},</if>
<if test="data.costRate != null">cost_rate = #{data.costRate},</if>
<if test="data.picture != null">picture = #{data.picture},</if>
</trim>
where channel_id = #{data.channelId}
</update>
<!-- <delete id="deleteSmChannelByChannelId" parameterType="Long">-->
<!-- delete from sm_channel where channel_id = #{channelId}-->
<!-- </delete>-->
<delete id="deleteSmChannelByChannelId" parameterType="Long">
delete from sm_channel where channel_id = #{channelId}
</delete>
<!-- <delete id="deleteSmChannelByChannelIds" parameterType="String">-->
<!-- delete from sm_channel where channel_id in-->
<!-- <foreach item="channelId" collection="array" open="(" separator="," close=")">-->
<!-- #{channelId}-->
<!-- </foreach>-->
<!-- </delete>-->
<delete id="deleteSmChannelByChannelIds" parameterType="String">
delete from sm_channel where channel_id in
<foreach item="channelId" collection="array" open="(" separator="," close=")">
#{channelId}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,105 @@
<?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.ruoyi.system.mapper.ChannelWithdrawMapper">
<resultMap type="ChannelWithdrawVO" id="ChannelWithdrawResult" autoMapping="true">
<result property="serviceRate" column="service_rate" typeHandler="com.ruoyi.system.mapper.typehandler.NonNullDecimalTypeHandler"/>
<result property="costRate" column="cost_rate" typeHandler="com.ruoyi.system.mapper.typehandler.NonNullDecimalTypeHandler"/>
</resultMap>
<sql id="selectChannelWithdrawVo">
select
scw.channel_id,
scw.name,
scw.account_type,
scw.service_type,
scw.service_rate,
scw.enabled,
scw.cost_rate,
scw.picture,
scw.min_amount,
scw.max_amount
from ss_channel_withdraw scw
</sql>
<sql id="searchCondition">
<if test="query.channelId != null "> and scw.channel_id = #{query.channelId}</if>
<if test="query.name != null and query.name != ''"> and scw.name like concat('%', #{query.name}, '%')</if>
<if test="query.accountType != null and query.accountType != ''"> and scw.account_type = #{query.accountType}</if>
<if test="query.serviceType != null and query.serviceType != ''"> and scw.service_type = #{query.serviceType}</if>
<if test="query.enabled != null "> and scw.enabled = #{query.enabled}</if>
<if test="query.accountTypes != null and query.accountTypes.size() > 0">
and scw.account_type in
<foreach item="item" collection="query.accountTypes" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</sql>
<select id="selectChannelWithdrawList" parameterType="ChannelWithdrawQuery" resultMap="ChannelWithdrawResult">
<include refid="selectChannelWithdrawVo"/>
<where>
<include refid="searchCondition"/>
</where>
</select>
<select id="selectChannelWithdrawByChannelId" parameterType="Long" resultMap="ChannelWithdrawResult">
<include refid="selectChannelWithdrawVo"/>
where channel_id = #{channelId}
</select>
<insert id="insertChannelWithdraw" parameterType="ChannelWithdraw" useGeneratedKeys="true" keyProperty="channelId">
insert into ss_channel_withdraw
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">name,</if>
<if test="accountType != null and accountType != ''">account_type,</if>
<if test="serviceType != null and serviceType != ''">service_type,</if>
<if test="serviceRate != null">service_rate,</if>
<if test="enabled != null">enabled,</if>
<if test="costRate != null">cost_rate,</if>
<if test="picture != null">picture,</if>
<if test="minAmount != null">min_amount,</if>
<if test="maxAmount != null">max_amount,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">#{name},</if>
<if test="accountType != null and accountType != ''">#{accountType},</if>
<if test="serviceType != null and serviceType != ''">#{serviceType},</if>
<if test="serviceRate != null">#{serviceRate},</if>
<if test="enabled != null">#{enabled},</if>
<if test="costRate != null">#{costRate},</if>
<if test="picture != null">#{picture},</if>
<if test="minAmount != null">#{minAmount},</if>
<if test="maxAmount != null">#{maxAmount},</if>
</trim>
</insert>
<update id="updateChannelWithdraw" parameterType="ChannelWithdraw">
update ss_channel_withdraw
<trim prefix="SET" suffixOverrides=",">
<if test="data.name != null and data.name != ''">name = #{data.name},</if>
<if test="data.accountType != null and data.accountType != ''">account_type = #{data.accountType},</if>
<if test="data.serviceType != null and data.serviceType != ''">service_type = #{data.serviceType},</if>
<if test="data.serviceRate != null">service_rate = #{data.serviceRate},</if>
<if test="data.enabled != null">enabled = #{data.enabled},</if>
<if test="data.costRate != null">cost_rate = #{data.costRate},</if>
<if test="data.picture != null">picture = #{data.picture},</if>
<if test="data.minAmount != null">min_amount = #{data.minAmount},</if>
<if test="data.maxAmount != null">max_amount = #{data.maxAmount},</if>
</trim>
where channel_id = #{data.channelId}
</update>
<delete id="deleteChannelWithdrawByChannelId" parameterType="Long">
delete from ss_channel_withdraw where channel_id = #{channelId}
</delete>
<delete id="deleteChannelWithdrawByChannelIds" parameterType="String">
delete from ss_channel_withdraw where channel_id in
<foreach item="channelId" collection="array" open="(" separator="," close=")">
#{channelId}
</foreach>
</delete>
</mapper>