diff --git a/ridelease-admin/src/main/java/com/ruoyi/web/controller/appAgent/AppAgentController.java b/ridelease-admin/src/main/java/com/ruoyi/web/controller/appAgent/AppAgentController.java index 96d26de..e427057 100644 --- a/ridelease-admin/src/main/java/com/ruoyi/web/controller/appAgent/AppAgentController.java +++ b/ridelease-admin/src/main/java/com/ruoyi/web/controller/appAgent/AppAgentController.java @@ -15,12 +15,12 @@ import com.ruoyi.system.domain.accessory.RlAccessory; import com.ruoyi.system.domain.agent.RlAgentVO; import com.ruoyi.system.domain.device.RlDeviceQuery; import com.ruoyi.system.domain.device.RlDeviceVO; -import com.ruoyi.system.domain.model.RlModel; import com.ruoyi.system.domain.model.RlModelQuery; import com.ruoyi.system.domain.order.RlOrderQuery; import com.ruoyi.system.domain.order.RlOrderVO; import com.ruoyi.system.domain.rule.RlFeeRule; import com.ruoyi.system.domain.userExt.RlUserExt; +import com.ruoyi.system.domain.userWithdraw.RlUserWithdraw; import com.ruoyi.system.service.*; import com.ruoyi.system.service.store.RlStoreService; import com.ruoyi.system.service.store.StoreAssembler; @@ -82,6 +82,9 @@ public class AppAgentController extends BaseController @Autowired private IRlAccessoryService rlAccessoryService; + @Autowired + private IRlUserWithdrawService userWithdrawService; + /** * 车辆列表 */ @@ -264,4 +267,29 @@ public class AppAgentController extends BaseController return success(list); } + /** + * 根据token获取提现渠道的列表 + */ + @GetMapping("/getUserWithdrawChannelList") + public AjaxResult getUserWithdrawChannelList() + { + logger.info("根据token获取提现渠道列表:【userId="+getUserId()+"】"); + return AjaxResult.success(userWithdrawService.selectRlUserWithdrawListByUserId(getUserId())); + } + + /** + * 上传收款码 + */ + @Log(title = "上传收款码", businessType = BusinessType.UPLOADQRCODE) + @PostMapping("/uploadPaymentCode") + public AjaxResult edit(String collectionCode,Long userWithdrawChannelId) + { + logger.info("上传收款码:【collectionCode="+collectionCode+",用户提现渠道id[userWithdrawChannelId]="+userWithdrawChannelId+"】"); + RlUserWithdraw userWithdraw = new RlUserWithdraw(); + userWithdraw.setChannelId(userWithdrawChannelId); + userWithdraw.setCollectionCode(collectionCode); + int i = userWithdrawService.updateRlUserWithdraw(userWithdraw); + return toAjax(i); + } + } diff --git a/ridelease-admin/src/main/java/com/ruoyi/web/controller/appadmin/AppAdminController.java b/ridelease-admin/src/main/java/com/ruoyi/web/controller/appadmin/AppAdminController.java index b3b5679..b437e9d 100644 --- a/ridelease-admin/src/main/java/com/ruoyi/web/controller/appadmin/AppAdminController.java +++ b/ridelease-admin/src/main/java/com/ruoyi/web/controller/appadmin/AppAdminController.java @@ -175,31 +175,31 @@ public class AppAdminController extends BaseController return success(devices); } - /** - * 上传收款码 - * type:1-微信收款码,2-支付宝收款码 - */ - @Log(title = "上传收款码", businessType = BusinessType.UPDATE) - @PostMapping("/uploadPaymentCode") - public AjaxResult uploadPaymentCode(String collectionCode,String type) - { - log.info("【上传收款码】请求参数:collectionCode={}", collectionCode); - if(collectionCode == null || collectionCode.equals("")){ - return AjaxResult.warn("收款码不能为空"); - } - if(type == null || type.equals("")){ - return AjaxResult.warn("收款码类型不能为空"); - } - RlUserExt userExt = new RlUserExt(); - userExt.setUserId(getUserId()); - if(type.equals("1")){ - userExt.setWxCollectionCode(collectionCode); - }else{ - userExt.setAliCollectionCode(collectionCode); - } - int result = rlUserExtService.updateRlUserExt(userExt); - return toAjax(result); - } +// /** +// * 上传收款码 +// * type:1-微信收款码,2-支付宝收款码 +// */ +// @Log(title = "上传收款码", businessType = BusinessType.UPDATE) +// @PostMapping("/uploadPaymentCode") +// public AjaxResult uploadPaymentCode(String collectionCode,String type) +// { +// log.info("【上传收款码】请求参数:collectionCode={}", collectionCode); +// if(collectionCode == null || collectionCode.equals("")){ +// return AjaxResult.warn("收款码不能为空"); +// } +// if(type == null || type.equals("")){ +// return AjaxResult.warn("收款码类型不能为空"); +// } +// RlUserExt userExt = new RlUserExt(); +// userExt.setUserId(getUserId()); +// if(type.equals("1")){ +// userExt.setWxCollectionCode(collectionCode); +// }else{ +// userExt.setAliCollectionCode(collectionCode); +// } +// int result = rlUserExtService.updateRlUserExt(userExt); +// return toAjax(result); +// } /** diff --git a/ridelease-admin/src/main/java/com/ruoyi/web/controller/rl/RlUserController.java b/ridelease-admin/src/main/java/com/ruoyi/web/controller/rl/RlUserController.java index ad2acc2..e5d8ca6 100644 --- a/ridelease-admin/src/main/java/com/ruoyi/web/controller/rl/RlUserController.java +++ b/ridelease-admin/src/main/java/com/ruoyi/web/controller/rl/RlUserController.java @@ -154,8 +154,6 @@ public class RlUserController extends BaseController userExt.setDividendProportion(user.getDividendProportion().divide(BigDecimal.valueOf(100))); userExt.setCooperationTime(user.getCooperationTime()); userExt.setDividendStatus(user.getDividendStatus()); - userExt.setHandlingChargeType(user.getHandlingChargeType()); - userExt.setWithdrawHandlingCharge(user.getWithdrawHandlingCharge()); RlAgentVO agentVO = agentService.selectRlAgentByCityId(user.getCityId()); userExt.setAgentId(agentVO.getAgentId()); int i1 = userExtService.insertRlUserExt(userExt); diff --git a/ridelease-admin/src/main/java/com/ruoyi/web/controller/rl/RlUserWithdrawController.java b/ridelease-admin/src/main/java/com/ruoyi/web/controller/rl/RlUserWithdrawController.java new file mode 100644 index 0000000..1ecec44 --- /dev/null +++ b/ridelease-admin/src/main/java/com/ruoyi/web/controller/rl/RlUserWithdrawController.java @@ -0,0 +1,98 @@ +package com.ruoyi.web.controller.rl; + +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.userWithdraw.RlUserWithdraw; +import com.ruoyi.system.service.IRlUserWithdrawService; +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 qzz + * @date 2024-10-21 + */ +@RestController +@RequestMapping("/system/userWithdraw") +public class RlUserWithdrawController extends BaseController +{ + @Autowired + private IRlUserWithdrawService rlUserWithdrawService; + + /** + * 查询用户提现渠道列表 + */ + @PreAuthorize("@ss.hasPermi('system:userWithdraw:list')") + @GetMapping("/list") + public TableDataInfo list(RlUserWithdraw rlUserWithdraw) + { + startPage(); + List list = rlUserWithdrawService.selectRlUserWithdrawList(rlUserWithdraw); + return getDataTable(list); + } + + /** + * 导出用户提现渠道列表 + */ + @PreAuthorize("@ss.hasPermi('system:userWithdraw:export')") + @Log(title = "用户提现渠道", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, RlUserWithdraw rlUserWithdraw) + { + List list = rlUserWithdrawService.selectRlUserWithdrawList(rlUserWithdraw); + ExcelUtil util = new ExcelUtil(RlUserWithdraw.class); + util.exportExcel(response, list, "用户提现渠道数据"); + } + + /** + * 获取用户提现渠道详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:userWithdraw:query')") + @GetMapping(value = "/{userChannelId}") + public AjaxResult getInfo(@PathVariable("userChannelId") Long userChannelId) + { + return success(rlUserWithdrawService.selectRlUserWithdrawByUserChannelId(userChannelId)); + } + + /** + * 新增用户提现渠道 + */ + @PreAuthorize("@ss.hasPermi('system:userWithdraw:add')") + @Log(title = "用户提现渠道", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody RlUserWithdraw rlUserWithdraw) + { + return toAjax(rlUserWithdrawService.insertRlUserWithdraw(rlUserWithdraw)); + } + + /** + * 修改用户提现渠道 + */ + @PreAuthorize("@ss.hasPermi('system:userWithdraw:edit')") + @Log(title = "用户提现渠道", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody RlUserWithdraw rlUserWithdraw) + { + return toAjax(rlUserWithdrawService.updateRlUserWithdraw(rlUserWithdraw)); + } + + /** + * 删除用户提现渠道 + */ + @PreAuthorize("@ss.hasPermi('system:userWithdraw:remove')") + @Log(title = "用户提现渠道", businessType = BusinessType.DELETE) + @DeleteMapping("/{userChannelIds}") + public AjaxResult remove(@PathVariable Long[] userChannelIds) + { + return toAjax(rlUserWithdrawService.deleteRlUserWithdrawByUserChannelIds(userChannelIds)); + } +} diff --git a/ridelease-common/src/main/java/com/ruoyi/common/core/domain/entity/RlUserVO.java b/ridelease-common/src/main/java/com/ruoyi/common/core/domain/entity/RlUserVO.java index 3e94f10..dd1607a 100644 --- a/ridelease-common/src/main/java/com/ruoyi/common/core/domain/entity/RlUserVO.java +++ b/ridelease-common/src/main/java/com/ruoyi/common/core/domain/entity/RlUserVO.java @@ -12,7 +12,7 @@ public class RlUserVO extends RlUser{ private BigDecimal totalWithdrawAmount = new BigDecimal("0.00"); /** 余额 */ - private String balance; + private BigDecimal balance; /** 店铺名称 */ private String storeName; @@ -31,4 +31,7 @@ public class RlUserVO extends RlUser{ /** 分账状态:0-禁用;1-启动 */ private Boolean dividendStatus; + + /** 可提现金额 */ + private BigDecimal withdrawableAmount; } diff --git a/ridelease-common/src/main/java/com/ruoyi/common/enums/BusinessType.java b/ridelease-common/src/main/java/com/ruoyi/common/enums/BusinessType.java index 0d9cf1e..d36f9b8 100644 --- a/ridelease-common/src/main/java/com/ruoyi/common/enums/BusinessType.java +++ b/ridelease-common/src/main/java/com/ruoyi/common/enums/BusinessType.java @@ -139,5 +139,9 @@ public enum BusinessType /** * 保存店铺 */ - SAVESTORE + SAVESTORE, + /** + * 上传收款码 + */ + UPLOADQRCODE, } diff --git a/ridelease-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java b/ridelease-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java index 17f39ae..1f97b10 100644 --- a/ridelease-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java +++ b/ridelease-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java @@ -13,9 +13,10 @@ import com.ruoyi.common.utils.http.HttpUtils; import com.ruoyi.common.utils.wx.AccessTokenUtil; import com.ruoyi.common.utils.wx.vo.WeChatMiniAuthorizeVo; import com.ruoyi.common.core.domain.entity.RlUser; +import com.ruoyi.system.domain.channelWithdraw.ChannelWithdrawVO; import com.ruoyi.system.domain.userExt.RlUserExt; -import com.ruoyi.system.service.IRlUserExtService; -import com.ruoyi.system.service.IRlUserService; +import com.ruoyi.system.domain.userWithdraw.RlUserWithdraw; +import com.ruoyi.system.service.*; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.ObjectUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -43,9 +44,10 @@ import com.ruoyi.common.utils.ip.IpUtils; import com.ruoyi.framework.manager.AsyncManager; import com.ruoyi.framework.manager.factory.AsyncFactory; import com.ruoyi.framework.security.context.AuthenticationContextHolder; -import com.ruoyi.system.service.ISysConfigService; import com.ruoyi.system.service.IRlUserService; +import java.util.List; + /** * 登录校验方法 * @@ -73,6 +75,12 @@ public class SysLoginService @Autowired private IRlUserExtService rlUserExtService; + @Autowired + private RlChannelWithdrawService channelWithdrawService; + + @Autowired + private IRlUserWithdrawService userWithdrawService; + @Value("${wx.appid1}") private String appId1; @@ -343,9 +351,32 @@ public class SysLoginService RlUserExt rlUserExt = new RlUserExt(); rlUserExt.setUserId(asUser.getUserId()); rlUserExt.setExtId(asUser.getUserId()); + /** 将系统的全局配置复制到用户提现渠道表中 新建用户提现渠道 */ + userWithdrawalChannel(rlUserExt); return rlUserExtService.insertRlUserExt(rlUserExt); } + private void userWithdrawalChannel(RlUserExt rlUserExt) { + List channelWithdrawVOS = channelWithdrawService.selectAllChannelWithdrawList(); + for (ChannelWithdrawVO channelWithdrawVO : channelWithdrawVOS) { + RlUserWithdraw rlUserWithdraw = new RlUserWithdraw(); + rlUserWithdraw.setHandlingChargeType(channelWithdrawVO.getHandlingChargeType()); + rlUserWithdraw.setWithdrawHandlingCharge(channelWithdrawVO.getWithdrawHandlingCharge()); + rlUserWithdraw.setUserId(rlUserExt.getUserId()); + rlUserWithdraw.setChannelId(channelWithdrawVO.getChannelId()); + rlUserWithdraw.setIsOpen("1"); + rlUserWithdraw.setMaxAmount(channelWithdrawVO.getMaxAmount()); + rlUserWithdraw.setMinAmount(channelWithdrawVO.getMinAmount()); + rlUserWithdraw.setName(channelWithdrawVO.getName()); + rlUserWithdraw.setPicture(channelWithdrawVO.getPicture()); + rlUserWithdraw.setIsNeedCode(channelWithdrawVO.getIsNeedCode()); + int i = userWithdrawService.insertRlUserWithdraw(rlUserWithdraw); + if(i>0){ + log.info("【微信登录/wxlogin】用户【{}】创建用户提现渠道【{}】", rlUserExt.getUserId(), JSON.toJSON(rlUserWithdraw)); + } + } + } + /** * 记录app登录信息 * diff --git a/ridelease-system/src/main/java/com/ruoyi/system/domain/channelWithdraw/ChannelWithdraw.java b/ridelease-system/src/main/java/com/ruoyi/system/domain/channelWithdraw/ChannelWithdraw.java index 0a6af82..e92cbeb 100644 --- a/ridelease-system/src/main/java/com/ruoyi/system/domain/channelWithdraw/ChannelWithdraw.java +++ b/ridelease-system/src/main/java/com/ruoyi/system/domain/channelWithdraw/ChannelWithdraw.java @@ -53,4 +53,8 @@ public class ChannelWithdraw extends BaseEntity @Min(value = 0, message = "单笔最高提现金额不能小于0") private BigDecimal maxAmount; + /** 是否需要上传收款码:0-不需要;1-需要 */ + @Excel(name = "是否需要上传收款码") + private String isNeedCode; + } diff --git a/ridelease-system/src/main/java/com/ruoyi/system/domain/userExt/RlUserExt.java b/ridelease-system/src/main/java/com/ruoyi/system/domain/userExt/RlUserExt.java index 220de74..76e6623 100644 --- a/ridelease-system/src/main/java/com/ruoyi/system/domain/userExt/RlUserExt.java +++ b/ridelease-system/src/main/java/com/ruoyi/system/domain/userExt/RlUserExt.java @@ -52,9 +52,9 @@ public class RlUserExt extends BaseEntity /** 代理商id */ private Long agentId; - /** 提现手续费类型:1-按比例,2-按每笔 */ - private String handlingChargeType; +// /** 提现手续费类型:1-按比例,2-按每笔 */ +// private String handlingChargeType; - /** 服务费 */ - private BigDecimal withdrawHandlingCharge; +// /** 服务费 */ +// private BigDecimal withdrawHandlingCharge; } diff --git a/ridelease-system/src/main/java/com/ruoyi/system/domain/userWithdraw/RlUserWithdraw.java b/ridelease-system/src/main/java/com/ruoyi/system/domain/userWithdraw/RlUserWithdraw.java new file mode 100644 index 0000000..bb947ac --- /dev/null +++ b/ridelease-system/src/main/java/com/ruoyi/system/domain/userWithdraw/RlUserWithdraw.java @@ -0,0 +1,69 @@ +package com.ruoyi.system.domain.userWithdraw; + +import java.math.BigDecimal; + +import lombok.Data; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 用户提现渠道对象 rl_user_withdraw + * + * @author qzz + * @date 2024-10-21 + */ +@Data +public class RlUserWithdraw extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** id */ + private Long userChannelId; + + /** 用户 */ + @Excel(name = "用户") + private Long userId; + + /** 提现渠道ID */ + @Excel(name = "提现渠道ID") + private Long channelId; + + /** 渠道名称 */ + @Excel(name = "渠道名称") + private String name; + + /** 提现手续费类型:1-按比例,2-按每笔 */ + @Excel(name = "提现手续费类型:1-按比例,2-按每笔") + private String handlingChargeType; + + /** 提现手续费 */ + @Excel(name = "提现手续费") + private BigDecimal withdrawHandlingCharge; + + /** 单笔最低提现金额 */ + @Excel(name = "单笔最低提现金额") + private BigDecimal minAmount; + + /** 单笔最高提现金额 */ + @Excel(name = "单笔最高提现金额") + private BigDecimal maxAmount; + + /** 是否开通 */ + @Excel(name = "是否开通") + private String isOpen; + + /** 渠道图片 */ + @Excel(name = "渠道图片") + private String picture; + + /** 收款码 */ + @Excel(name = "收款码") + private String collectionCode; + + /** 是否需要上传收款码:0-不需要;1-需要 */ + @Excel(name = "是否需要上传收款码") + private String isNeedCode; + +} diff --git a/ridelease-system/src/main/java/com/ruoyi/system/domain/userWithdraw/RlUserWithdrawQuery.java b/ridelease-system/src/main/java/com/ruoyi/system/domain/userWithdraw/RlUserWithdrawQuery.java new file mode 100644 index 0000000..982610d --- /dev/null +++ b/ridelease-system/src/main/java/com/ruoyi/system/domain/userWithdraw/RlUserWithdrawQuery.java @@ -0,0 +1,7 @@ +package com.ruoyi.system.domain.userWithdraw; + +import lombok.Data; + +@Data +public class RlUserWithdrawQuery extends RlUserWithdraw{ +} diff --git a/ridelease-system/src/main/java/com/ruoyi/system/domain/userWithdraw/RlUserWithdrawVO.java b/ridelease-system/src/main/java/com/ruoyi/system/domain/userWithdraw/RlUserWithdrawVO.java new file mode 100644 index 0000000..86cfea8 --- /dev/null +++ b/ridelease-system/src/main/java/com/ruoyi/system/domain/userWithdraw/RlUserWithdrawVO.java @@ -0,0 +1,8 @@ +package com.ruoyi.system.domain.userWithdraw; + +import lombok.Data; + +@Data +public class RlUserWithdrawVO extends RlUserWithdraw{ + +} diff --git a/ridelease-system/src/main/java/com/ruoyi/system/domain/withdraw/RlWithdraw.java b/ridelease-system/src/main/java/com/ruoyi/system/domain/withdraw/RlWithdraw.java index e0e04f7..8f9658a 100644 --- a/ridelease-system/src/main/java/com/ruoyi/system/domain/withdraw/RlWithdraw.java +++ b/ridelease-system/src/main/java/com/ruoyi/system/domain/withdraw/RlWithdraw.java @@ -62,6 +62,10 @@ public class RlWithdraw extends BaseEntity @Excel(name = "提现渠道id") private Long withdrawChannelId; + /** 用户提现渠道id */ + @Excel(name = "用户提现渠道id") + private Long userWithdrawChannelId; + /** 提现手续费类型:1-按比例,2-按每笔 */ private String handlingChargeType; diff --git a/ridelease-system/src/main/java/com/ruoyi/system/mapper/RlChannelWithdrawMapper.java b/ridelease-system/src/main/java/com/ruoyi/system/mapper/RlChannelWithdrawMapper.java index 492123c..7e2df35 100644 --- a/ridelease-system/src/main/java/com/ruoyi/system/mapper/RlChannelWithdrawMapper.java +++ b/ridelease-system/src/main/java/com/ruoyi/system/mapper/RlChannelWithdrawMapper.java @@ -31,6 +31,8 @@ public interface RlChannelWithdrawMapper */ public List selectChannelWithdrawList(@Param("query") ChannelWithdrawQuery query); + + /** * 新增提现渠道 * @@ -62,4 +64,11 @@ public interface RlChannelWithdrawMapper * @return 结果 */ public int deleteChannelWithdrawByChannelIds(Long[] channelIds); + + /** + * 查询所有提现渠道列表 + * + * @return 提现渠道 + */ + List selectAllChannelWithdrawList(); } diff --git a/ridelease-system/src/main/java/com/ruoyi/system/mapper/RlUserMapper.java b/ridelease-system/src/main/java/com/ruoyi/system/mapper/RlUserMapper.java index 9dca9f0..c6fe5ab 100644 --- a/ridelease-system/src/main/java/com/ruoyi/system/mapper/RlUserMapper.java +++ b/ridelease-system/src/main/java/com/ruoyi/system/mapper/RlUserMapper.java @@ -199,4 +199,9 @@ public interface RlUserMapper * 更新用户余额 */ int changeBalance(@Param("changeAmount")BigDecimal changeAmount,@Param("userId")Long userId); + + /** + * 获取今日订单金额 + */ + BigDecimal selectTodayOrderAmount(Long userId); } diff --git a/ridelease-system/src/main/java/com/ruoyi/system/mapper/RlUserWithdrawMapper.java b/ridelease-system/src/main/java/com/ruoyi/system/mapper/RlUserWithdrawMapper.java new file mode 100644 index 0000000..d0b0f87 --- /dev/null +++ b/ridelease-system/src/main/java/com/ruoyi/system/mapper/RlUserWithdrawMapper.java @@ -0,0 +1,70 @@ +package com.ruoyi.system.mapper; + +import com.ruoyi.system.domain.userWithdraw.RlUserWithdraw; + +import java.util.List; + +/** + * 用户提现渠道Mapper接口 + * + * @author qzz + * @date 2024-10-21 + */ +public interface RlUserWithdrawMapper +{ + /** + * 查询用户提现渠道 + * + * @param userChannelId 用户提现渠道主键 + * @return 用户提现渠道 + */ + public RlUserWithdraw selectRlUserWithdrawByUserChannelId(Long userChannelId); + + /** + * 查询用户提现渠道列表 + * + * @param rlUserWithdraw 用户提现渠道 + * @return 用户提现渠道集合 + */ + public List selectRlUserWithdrawList(RlUserWithdraw rlUserWithdraw); + + /** + * 新增用户提现渠道 + * + * @param rlUserWithdraw 用户提现渠道 + * @return 结果 + */ + public int insertRlUserWithdraw(RlUserWithdraw rlUserWithdraw); + + /** + * 修改用户提现渠道 + * + * @param rlUserWithdraw 用户提现渠道 + * @return 结果 + */ + public int updateRlUserWithdraw(RlUserWithdraw rlUserWithdraw); + + /** + * 删除用户提现渠道 + * + * @param userChannelId 用户提现渠道主键 + * @return 结果 + */ + public int deleteRlUserWithdrawByUserChannelId(Long userChannelId); + + /** + * 批量删除用户提现渠道 + * + * @param userChannelIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteRlUserWithdrawByUserChannelIds(Long[] userChannelIds); + + /** + * 根据userId查询用户提现渠道列表 + * + * @param userId 用户id + * @return 用户提现渠道集合 + */ + List selectRlUserWithdrawListByUserId(Long userId); +} diff --git a/ridelease-system/src/main/java/com/ruoyi/system/service/IRlUserWithdrawService.java b/ridelease-system/src/main/java/com/ruoyi/system/service/IRlUserWithdrawService.java new file mode 100644 index 0000000..c6d95bc --- /dev/null +++ b/ridelease-system/src/main/java/com/ruoyi/system/service/IRlUserWithdrawService.java @@ -0,0 +1,70 @@ +package com.ruoyi.system.service; + +import com.ruoyi.system.domain.userWithdraw.RlUserWithdraw; + +import java.util.List; + +/** + * 用户提现渠道Service接口 + * + * @author qzz + * @date 2024-10-21 + */ +public interface IRlUserWithdrawService +{ + /** + * 查询用户提现渠道 + * + * @param userChannelId 用户提现渠道主键 + * @return 用户提现渠道 + */ + public RlUserWithdraw selectRlUserWithdrawByUserChannelId(Long userChannelId); + + /** + * 查询用户提现渠道列表 + * + * @param rlUserWithdraw 用户提现渠道 + * @return 用户提现渠道集合 + */ + public List selectRlUserWithdrawList(RlUserWithdraw rlUserWithdraw); + + /** + * 根据userId查询用户提现渠道列表 + * + * @param userId 用户id + * @return 用户提现渠道集合 + */ + public List selectRlUserWithdrawListByUserId(Long userId); + + /** + * 新增用户提现渠道 + * + * @param rlUserWithdraw 用户提现渠道 + * @return 结果 + */ + public int insertRlUserWithdraw(RlUserWithdraw rlUserWithdraw); + + /** + * 修改用户提现渠道 + * + * @param rlUserWithdraw 用户提现渠道 + * @return 结果 + */ + public int updateRlUserWithdraw(RlUserWithdraw rlUserWithdraw); + + /** + * 批量删除用户提现渠道 + * + * @param userChannelIds 需要删除的用户提现渠道主键集合 + * @return 结果 + */ + public int deleteRlUserWithdrawByUserChannelIds(Long[] userChannelIds); + + /** + * 删除用户提现渠道信息 + * + * @param userChannelId 用户提现渠道主键 + * @return 结果 + */ + public int deleteRlUserWithdrawByUserChannelId(Long userChannelId); +} diff --git a/ridelease-system/src/main/java/com/ruoyi/system/service/RlChannelWithdrawService.java b/ridelease-system/src/main/java/com/ruoyi/system/service/RlChannelWithdrawService.java index 234f4d9..f8ab3ba 100644 --- a/ridelease-system/src/main/java/com/ruoyi/system/service/RlChannelWithdrawService.java +++ b/ridelease-system/src/main/java/com/ruoyi/system/service/RlChannelWithdrawService.java @@ -31,6 +31,13 @@ public interface RlChannelWithdrawService */ public List selectChannelWithdrawList(ChannelWithdrawQuery channelWithdraw); + /** + * 查询所有提现渠道列表 + * + * @return 提现渠道集合 + */ + public List selectAllChannelWithdrawList(); + /** * 新增提现渠道 * diff --git a/ridelease-system/src/main/java/com/ruoyi/system/service/impl/RlChannelWithdrawServiceImpl.java b/ridelease-system/src/main/java/com/ruoyi/system/service/impl/RlChannelWithdrawServiceImpl.java index 406159e..8fdd524 100644 --- a/ridelease-system/src/main/java/com/ruoyi/system/service/impl/RlChannelWithdrawServiceImpl.java +++ b/ridelease-system/src/main/java/com/ruoyi/system/service/impl/RlChannelWithdrawServiceImpl.java @@ -49,6 +49,16 @@ public class RlChannelWithdrawServiceImpl implements RlChannelWithdrawService return rlChannelWithdrawMapper.selectChannelWithdrawList(channelWithdraw); } + /** + * 查询所有提现渠道列表 + * + * @return 提现渠道 + */ + @Override + public List selectAllChannelWithdrawList() { + return rlChannelWithdrawMapper.selectAllChannelWithdrawList(); + } + /** * 新增提现渠道 * diff --git a/ridelease-system/src/main/java/com/ruoyi/system/service/impl/RlUserServiceImpl.java b/ridelease-system/src/main/java/com/ruoyi/system/service/impl/RlUserServiceImpl.java index 3df0d30..782d971 100644 --- a/ridelease-system/src/main/java/com/ruoyi/system/service/impl/RlUserServiceImpl.java +++ b/ridelease-system/src/main/java/com/ruoyi/system/service/impl/RlUserServiceImpl.java @@ -25,6 +25,7 @@ import com.ruoyi.system.domain.channel.ChannelVO; import com.ruoyi.system.domain.channelWithdraw.ChannelWithdrawVO; import com.ruoyi.system.domain.query.AuthenticationQuery; import com.ruoyi.system.domain.userExt.RlUserExt; +import com.ruoyi.system.domain.userWithdraw.RlUserWithdraw; import com.ruoyi.system.domain.vo.RlUserQuery; import com.ruoyi.system.domain.withdraw.RlWithdraw; import com.ruoyi.system.domain.withdraw.RlWithdrawQuery; @@ -60,15 +61,6 @@ public class RlUserServiceImpl implements IRlUserService{ @Resource private RlUserMapper rlUserMapper; - @Resource - private IRlUserExtService userExtService; - - @Resource - private IRlAgentService agentService; - - @Autowired - private RlChannelService channelService; - @Autowired protected Validator validator; @@ -99,6 +91,9 @@ public class RlUserServiceImpl implements IRlUserService{ @Autowired private IRlChangeBalanceService changeBalanceService; + @Autowired + private IRlUserWithdrawService userWithdrawService; + @Value("${aliyun.accessKeyId}") private String accessKeyId; @@ -219,6 +214,10 @@ public class RlUserServiceImpl implements IRlUserService{ totalWithdrawAmount = BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP); } users.setTotalWithdrawAmount(totalWithdrawAmount); + /** 可提现金额 等于余额-今日订单金额 */ + BigDecimal balance = users.getBalance(); + BigDecimal todayOrderAmount = rlUserMapper.selectTodayOrderAmount(userId); + users.setWithdrawableAmount(balance.subtract(todayOrderAmount)); return users; } @@ -751,11 +750,9 @@ public class RlUserServiceImpl implements IRlUserService{ String orderNo = IdUtils.getOrderNo("tx"); /** 1. 获取当前用户*/ RlUser user = rlUserMapper.selectUserById(SecurityUtils.getUserId()); - RlUserExt rlUserExt = userExtService.selectRlUserExtByUserId(user.getUserId()); - Boolean execute = transactionTemplate.execute(e -> { /** 2. 记录提现记录*/ - withdrawalRecord(withdraw, orderNo, user, rlUserExt); + withdrawalRecord(withdraw, orderNo, user); /** 3. 扣余额,记录账变 */ int i = changeBalanceService.generateChanggeBalance(orderNo, null, ServiceConstants.FLOW_TYPE_DISBURSE, ServiceConstants.WITHDRAWAL, withdraw.getAmount(), user.getUserId(), user.getUserName(), user.getPhonenumber()); @@ -776,7 +773,7 @@ public class RlUserServiceImpl implements IRlUserService{ return rlUserMapper.changeBalance(changeAmount, userId); } - private void withdrawalRecord(RlWithdrawQuery withdraw, String orderNo, RlUser user, RlUserExt rlUserExt) { + private void withdrawalRecord(RlWithdrawQuery withdraw, String orderNo, RlUser user) { RlWithdraw rlWithdraw = new RlWithdraw(); rlWithdraw.setWithdrawNo(orderNo); rlWithdraw.setCreateTime(DateUtils.getNowDate()); @@ -798,16 +795,17 @@ public class RlUserServiceImpl implements IRlUserService{ rlWithdraw.setCost(cost); rlWithdraw.setWithdrawChannelId(withdraw.getWithdrawChannelId()); BigDecimal handlingCharge; - if(rlUserExt.getHandlingChargeType().equals(ServiceConstants.HANDLING_CHARGE_TYPE_PERCENT)){ - BigDecimal handlingCharge1 = rlUserExt.getWithdrawHandlingCharge();// 5.4 + RlUserWithdraw rlUserWithdraw = userWithdrawService.selectRlUserWithdrawByUserChannelId(withdraw.getUserWithdrawChannelId()); + if(rlUserWithdraw.getHandlingChargeType().equals(ServiceConstants.HANDLING_CHARGE_TYPE_PERCENT)){ + BigDecimal handlingCharge1 = rlUserWithdraw.getWithdrawHandlingCharge();// 5.4 BigDecimal bigDecimal = handlingCharge1.divide(new BigDecimal(100), 6, BigDecimal.ROUND_HALF_UP);// 0.0054 handlingCharge = bigDecimal.multiply(withdraw.getAmount()).setScale(2, RoundingMode.HALF_UP);// 0.0054 * 1000 = 0.54 }else{ - handlingCharge = rlUserExt.getWithdrawHandlingCharge(); + handlingCharge = rlUserWithdraw.getWithdrawHandlingCharge(); } rlWithdraw.setHandlingCharge(handlingCharge); - rlWithdraw.setHandlingChargeType(rlUserExt.getHandlingChargeType()); - rlWithdraw.setWithdrawHandlingCharge(rlUserExt.getWithdrawHandlingCharge()); + rlWithdraw.setHandlingChargeType(rlUserWithdraw.getHandlingChargeType()); + rlWithdraw.setWithdrawHandlingCharge(rlUserWithdraw.getWithdrawHandlingCharge()); int i = rlWithdrawService.insertRlWithdraw(rlWithdraw); if(i == 0){ throw new ServiceException("新增记录提现记录失败"); diff --git a/ridelease-system/src/main/java/com/ruoyi/system/service/impl/RlUserWithdrawServiceImpl.java b/ridelease-system/src/main/java/com/ruoyi/system/service/impl/RlUserWithdrawServiceImpl.java new file mode 100644 index 0000000..32cc41a --- /dev/null +++ b/ridelease-system/src/main/java/com/ruoyi/system/service/impl/RlUserWithdrawServiceImpl.java @@ -0,0 +1,107 @@ +package com.ruoyi.system.service.impl; + +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.system.domain.userWithdraw.RlUserWithdraw; +import com.ruoyi.system.mapper.RlUserWithdrawMapper; +import com.ruoyi.system.service.IRlUserWithdrawService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 用户提现渠道Service业务层处理 + * + * @author qzz + * @date 2024-10-21 + */ +@Service +public class RlUserWithdrawServiceImpl implements IRlUserWithdrawService +{ + @Resource + private RlUserWithdrawMapper rlUserWithdrawMapper; + + /** + * 查询用户提现渠道 + * + * @param userChannelId 用户提现渠道主键 + * @return 用户提现渠道 + */ + @Override + public RlUserWithdraw selectRlUserWithdrawByUserChannelId(Long userChannelId) + { + return rlUserWithdrawMapper.selectRlUserWithdrawByUserChannelId(userChannelId); + } + + /** + * 查询用户提现渠道列表 + * + * @param rlUserWithdraw 用户提现渠道 + * @return 用户提现渠道 + */ + @Override + public List selectRlUserWithdrawList(RlUserWithdraw rlUserWithdraw) + { + return rlUserWithdrawMapper.selectRlUserWithdrawList(rlUserWithdraw); + } + + /** + * 根据userId查询用户提现渠道列表 + * + * @param userId 用户id + * @return 用户提现渠道集合 + */ + @Override + public List selectRlUserWithdrawListByUserId(Long userId) { + return rlUserWithdrawMapper.selectRlUserWithdrawListByUserId(userId); + } + + /** + * 新增用户提现渠道 + * + * @param rlUserWithdraw 用户提现渠道 + * @return 结果 + */ + @Override + public int insertRlUserWithdraw(RlUserWithdraw rlUserWithdraw) + { + rlUserWithdraw.setCreateTime(DateUtils.getNowDate()); + return rlUserWithdrawMapper.insertRlUserWithdraw(rlUserWithdraw); + } + + /** + * 修改用户提现渠道 + * + * @param rlUserWithdraw 用户提现渠道 + * @return 结果 + */ + @Override + public int updateRlUserWithdraw(RlUserWithdraw rlUserWithdraw) + { + return rlUserWithdrawMapper.updateRlUserWithdraw(rlUserWithdraw); + } + + /** + * 批量删除用户提现渠道 + * + * @param userChannelIds 需要删除的用户提现渠道主键 + * @return 结果 + */ + @Override + public int deleteRlUserWithdrawByUserChannelIds(Long[] userChannelIds) + { + return rlUserWithdrawMapper.deleteRlUserWithdrawByUserChannelIds(userChannelIds); + } + + /** + * 删除用户提现渠道信息 + * + * @param userChannelId 用户提现渠道主键 + * @return 结果 + */ + @Override + public int deleteRlUserWithdrawByUserChannelId(Long userChannelId) + { + return rlUserWithdrawMapper.deleteRlUserWithdrawByUserChannelId(userChannelId); + } +} diff --git a/ridelease-system/src/main/java/com/ruoyi/system/service/store/impl/StoreServiceImpl.java b/ridelease-system/src/main/java/com/ruoyi/system/service/store/impl/StoreServiceImpl.java index b513968..abd2af7 100644 --- a/ridelease-system/src/main/java/com/ruoyi/system/service/store/impl/StoreServiceImpl.java +++ b/ridelease-system/src/main/java/com/ruoyi/system/service/store/impl/StoreServiceImpl.java @@ -1,6 +1,7 @@ package com.ruoyi.system.service.store.impl; import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson2.JSON; import com.ruoyi.common.constant.ServiceConstants; import com.ruoyi.common.core.domain.entity.RlUser; import com.ruoyi.common.exception.ServiceException; @@ -542,7 +543,7 @@ public class StoreServiceImpl implements RlStoreService List nearbyStores = allStores.stream() .map(store -> { List list = modelService.selectEModelListByStoreId(store.getStoreId()); - log.info("店铺【{}】的车型列表:{}", store.getStoreId(), list); + log.info("店铺【{}】的车型列表:{}", store.getStoreId(), JSON.toJSON(list)); // 如果 list 为空或为 null,直接返回 null if (list == null || list.isEmpty()) { return null; diff --git a/ridelease-system/src/main/resources/mapper/system/RlChannelWithdrawMapper.xml b/ridelease-system/src/main/resources/mapper/system/RlChannelWithdrawMapper.xml index 2fc333f..8a108f4 100644 --- a/ridelease-system/src/main/resources/mapper/system/RlChannelWithdrawMapper.xml +++ b/ridelease-system/src/main/resources/mapper/system/RlChannelWithdrawMapper.xml @@ -19,7 +19,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" scw.cost_rate, scw.picture, scw.min_amount, - scw.max_amount + scw.max_amount, + scw.is_need_code from rl_channel_withdraw scw @@ -42,6 +43,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where channel_id = #{channelId} + + insert into rl_channel_withdraw @@ -53,6 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" picture, min_amount, max_amount, + is_need_code, #{name}, @@ -63,6 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{picture}, #{minAmount}, #{maxAmount}, + #{isNeedCode}, @@ -77,6 +84,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" picture = #{data.picture}, min_amount = #{data.minAmount}, max_amount = #{data.maxAmount}, + is_need_code = #{data.isNeedCode}, where channel_id = #{data.channelId} diff --git a/ridelease-system/src/main/resources/mapper/system/RlUserMapper.xml b/ridelease-system/src/main/resources/mapper/system/RlUserMapper.xml index 7855763..e511672 100644 --- a/ridelease-system/src/main/resources/mapper/system/RlUserMapper.xml +++ b/ridelease-system/src/main/resources/mapper/system/RlUserMapper.xml @@ -201,6 +201,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where user_id = #{userId} + + insert into rl_user( user_id, diff --git a/ridelease-system/src/main/resources/mapper/system/RlUserWithdrawMapper.xml b/ridelease-system/src/main/resources/mapper/system/RlUserWithdrawMapper.xml new file mode 100644 index 0000000..dff0cf3 --- /dev/null +++ b/ridelease-system/src/main/resources/mapper/system/RlUserWithdrawMapper.xml @@ -0,0 +1,102 @@ + + + + + + + + select user_channel_id, user_id, channel_id, name, handling_charge_type, withdraw_handling_charge, + min_amount, max_amount, create_time, is_open, picture, collection_code, is_need_code + from rl_user_withdraw + + + + + + + + + + insert into rl_user_withdraw + + user_channel_id, + user_id, + channel_id, + name, + handling_charge_type, + withdraw_handling_charge, + min_amount, + max_amount, + create_time, + is_open, + picture, + collection_code, + is_need_code, + + + #{userChannelId}, + #{userId}, + #{channelId}, + #{name}, + #{handlingChargeType}, + #{withdrawHandlingCharge}, + #{minAmount}, + #{maxAmount}, + #{createTime}, + #{isOpen}, + #{picture}, + #{collectionCode}, + #{isNeedCode}, + + + + + update rl_user_withdraw + + user_id = #{userId}, + channel_id = #{channelId}, + name = #{name}, + handling_charge_type = #{handlingChargeType}, + withdraw_handling_charge = #{withdrawHandlingCharge}, + min_amount = #{minAmount}, + max_amount = #{maxAmount}, + create_time = #{createTime}, + is_open = #{isOpen}, + picture = #{picture}, + collection_code = #{collectionCode}, + is_need_code = #{isNeedCode}, + + where user_channel_id = #{userChannelId} + + + + delete from rl_user_withdraw where user_channel_id = #{userChannelId} + + + + delete from rl_user_withdraw where user_channel_id in + + #{userChannelId} + + +