diff --git a/electripper-admin/src/main/java/com/ruoyi/web/controller/system/ChannelWithdrawController.java b/electripper-admin/src/main/java/com/ruoyi/web/controller/system/ChannelWithdrawController.java new file mode 100644 index 0000000..d5f076d --- /dev/null +++ b/electripper-admin/src/main/java/com/ruoyi/web/controller/system/ChannelWithdrawController.java @@ -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 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 list = channelWithdrawService.selectChannelWithdrawList(query); + ExcelUtil util = new ExcelUtil(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)); + } +} diff --git a/electripper-admin/src/main/java/com/ruoyi/web/controller/system/SmChannelController.java b/electripper-admin/src/main/java/com/ruoyi/web/controller/system/SmChannelController.java index 6b07c93..abc5c54 100644 --- a/electripper-admin/src/main/java/com/ruoyi/web/controller/system/SmChannelController.java +++ b/electripper-admin/src/main/java/com/ruoyi/web/controller/system/SmChannelController.java @@ -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 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 list = smChannelService.selectSmChannelList(smChannel); -// ExcelUtil util = new ExcelUtil(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 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 list = smChannelService.selectSmChannelList(smChannel); + ExcelUtil util = new ExcelUtil(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)); + } + +} diff --git a/electripper-system/src/main/java/com/ruoyi/system/domain/Channel.java b/electripper-system/src/main/java/com/ruoyi/system/domain/Channel.java index 32f87a4..d6775e7 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/domain/Channel.java +++ b/electripper-system/src/main/java/com/ruoyi/system/domain/Channel.java @@ -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; } diff --git a/electripper-system/src/main/java/com/ruoyi/system/domain/ChannelWithdraw.java b/electripper-system/src/main/java/com/ruoyi/system/domain/ChannelWithdraw.java new file mode 100644 index 0000000..43dfcfc --- /dev/null +++ b/electripper-system/src/main/java/com/ruoyi/system/domain/ChannelWithdraw.java @@ -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; + +} diff --git a/electripper-system/src/main/java/com/ruoyi/system/domain/ChannelWithdrawQuery.java b/electripper-system/src/main/java/com/ruoyi/system/domain/ChannelWithdrawQuery.java new file mode 100644 index 0000000..fbfb8d8 --- /dev/null +++ b/electripper-system/src/main/java/com/ruoyi/system/domain/ChannelWithdrawQuery.java @@ -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 accountTypes; + +} diff --git a/electripper-system/src/main/java/com/ruoyi/system/domain/ChannelWithdrawVO.java b/electripper-system/src/main/java/com/ruoyi/system/domain/ChannelWithdrawVO.java new file mode 100644 index 0000000..fd5780c --- /dev/null +++ b/electripper-system/src/main/java/com/ruoyi/system/domain/ChannelWithdrawVO.java @@ -0,0 +1,11 @@ +package com.ruoyi.system.domain; + +import lombok.Data; + +/** + * @author wjh + * 2024/8/2 + */ +@Data +public class ChannelWithdrawVO extends ChannelWithdraw{ +} diff --git a/electripper-system/src/main/java/com/ruoyi/system/mapper/ChannelMapper.java b/electripper-system/src/main/java/com/ruoyi/system/mapper/ChannelMapper.java index 58826ee..9ef4923 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/mapper/ChannelMapper.java +++ b/electripper-system/src/main/java/com/ruoyi/system/mapper/ChannelMapper.java @@ -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 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 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); } diff --git a/electripper-system/src/main/java/com/ruoyi/system/mapper/ChannelWithdrawMapper.java b/electripper-system/src/main/java/com/ruoyi/system/mapper/ChannelWithdrawMapper.java new file mode 100644 index 0000000..d2bd489 --- /dev/null +++ b/electripper-system/src/main/java/com/ruoyi/system/mapper/ChannelWithdrawMapper.java @@ -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 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); +} diff --git a/electripper-system/src/main/java/com/ruoyi/system/mapper/typehandler/NonNullDecimalTypeHandler.java b/electripper-system/src/main/java/com/ruoyi/system/mapper/typehandler/NonNullDecimalTypeHandler.java new file mode 100644 index 0000000..36cd42c --- /dev/null +++ b/electripper-system/src/main/java/com/ruoyi/system/mapper/typehandler/NonNullDecimalTypeHandler.java @@ -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 { + + @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; + } +} diff --git a/electripper-system/src/main/java/com/ruoyi/system/service/ChannelService.java b/electripper-system/src/main/java/com/ruoyi/system/service/ChannelService.java index 817a1fe..15aa168 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/service/ChannelService.java +++ b/electripper-system/src/main/java/com/ruoyi/system/service/ChannelService.java @@ -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 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 selectEnabledRechargeList(); -// -// /** -// * 查询充值渠道映射表 -// * -// * @param query 查询条件 -// * @param keyMapper 映射函数 -// */ -// Map selectMap(ChannelQuery query, Function 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 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 selectEnabledRechargeList(); + + /** + * 查询充值渠道映射表 + * + * @param query 查询条件 + * @param keyMapper 映射函数 + */ + Map selectMap(ChannelQuery query, Function keyMapper); + +} diff --git a/electripper-system/src/main/java/com/ruoyi/system/service/ChannelWithdrawService.java b/electripper-system/src/main/java/com/ruoyi/system/service/ChannelWithdrawService.java new file mode 100644 index 0000000..c50546d --- /dev/null +++ b/electripper-system/src/main/java/com/ruoyi/system/service/ChannelWithdrawService.java @@ -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 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 selectEnabledList(Long userId); +} diff --git a/electripper-system/src/main/java/com/ruoyi/system/service/impl/ChannelServiceImpl.java b/electripper-system/src/main/java/com/ruoyi/system/service/impl/ChannelServiceImpl.java index f6d2cb1..d52e8c4 100644 --- a/electripper-system/src/main/java/com/ruoyi/system/service/impl/ChannelServiceImpl.java +++ b/electripper-system/src/main/java/com/ruoyi/system/service/impl/ChannelServiceImpl.java @@ -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 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 selectEnabledRechargeList() { -// ChannelQuery dto = new ChannelQuery(); -// dto.setEnabled(true); -// return this.selectSmChannelList(dto); -// } -// -// /** -// * 查询充值渠道映射表 -// * -// * @param query 查询条件 -// * @param keyMapper 映射函数 -// */ -// @Override -// public Map selectMap(ChannelQuery query, Function keyMapper) { -// List 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 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 selectEnabledRechargeList() { + ChannelQuery dto = new ChannelQuery(); + dto.setEnabled(true); + return this.selectSmChannelList(dto); + } + + /** + * 查询充值渠道映射表 + * + * @param query 查询条件 + * @param keyMapper 映射函数 + */ + @Override + public Map selectMap(ChannelQuery query, Function keyMapper) { + List 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)); + } +} diff --git a/electripper-system/src/main/java/com/ruoyi/system/service/impl/ChannelWithdrawServiceImpl.java b/electripper-system/src/main/java/com/ruoyi/system/service/impl/ChannelWithdrawServiceImpl.java new file mode 100644 index 0000000..ab7025d --- /dev/null +++ b/electripper-system/src/main/java/com/ruoyi/system/service/impl/ChannelWithdrawServiceImpl.java @@ -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 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 selectEnabledList(Long userId) { + // 查询用户账户列表 +// List 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; + } +} diff --git a/electripper-system/src/main/resources/mapper/system/ChannelMapper.xml b/electripper-system/src/main/resources/mapper/system/ChannelMapper.xml index 56f9b6a..2bbbf5d 100644 --- a/electripper-system/src/main/resources/mapper/system/ChannelMapper.xml +++ b/electripper-system/src/main/resources/mapper/system/ChannelMapper.xml @@ -4,90 +4,80 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - - - - + + + - - - - - - - - - - - + + select + sc.channel_id, + sc.name, + sc.enabled, + sc.cost_rate, + sc.picture + from sm_channel sc + - - - - - - - - - - - + + and sc.name like concat('%', #{query.name}, '%') + and sc.enabled = #{query.enabled} + + and sc.channel_id in + + #{item} + + + - - - - - - + - - - - + - - - - - - - - - - - - - - - - - - - - - + + insert into sm_channel + + channel_id, + `name`, + enabled, + cost_rate, + picture, + + + #{channelId}, + #{name}, + #{enabled}, + #{costRate}, + #{picture}, + + - - - - - - - - - - - - + + update sm_channel + + name = #{data.name}, + enabled = #{data.enabled}, + cost_rate = #{data.costRate}, + picture = #{data.picture}, + + where channel_id = #{data.channelId} + - - - + + delete from sm_channel where channel_id = #{channelId} + - - - - - - + + delete from sm_channel where channel_id in + + #{channelId} + + diff --git a/electripper-system/src/main/resources/mapper/system/ChannelWithdrawMapper.xml b/electripper-system/src/main/resources/mapper/system/ChannelWithdrawMapper.xml new file mode 100644 index 0000000..5df3456 --- /dev/null +++ b/electripper-system/src/main/resources/mapper/system/ChannelWithdrawMapper.xml @@ -0,0 +1,105 @@ + + + + + + + + + + + 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 + + + + and scw.channel_id = #{query.channelId} + and scw.name like concat('%', #{query.name}, '%') + and scw.account_type = #{query.accountType} + and scw.service_type = #{query.serviceType} + and scw.enabled = #{query.enabled} + + and scw.account_type in + + #{item} + + + + + + + + + + insert into ss_channel_withdraw + + name, + account_type, + service_type, + service_rate, + enabled, + cost_rate, + picture, + min_amount, + max_amount, + + + #{name}, + #{accountType}, + #{serviceType}, + #{serviceRate}, + #{enabled}, + #{costRate}, + #{picture}, + #{minAmount}, + #{maxAmount}, + + + + + update ss_channel_withdraw + + name = #{data.name}, + account_type = #{data.accountType}, + service_type = #{data.serviceType}, + service_rate = #{data.serviceRate}, + enabled = #{data.enabled}, + cost_rate = #{data.costRate}, + picture = #{data.picture}, + min_amount = #{data.minAmount}, + max_amount = #{data.maxAmount}, + + where channel_id = #{data.channelId} + + + + delete from ss_channel_withdraw where channel_id = #{channelId} + + + + delete from ss_channel_withdraw where channel_id in + + #{channelId} + + +