用户提现渠道

收款码
This commit is contained in:
邱贞招 2024-10-21 16:04:16 +08:00
parent 4ed575e7bb
commit 149c5ca4c4
25 changed files with 710 additions and 57 deletions

View File

@ -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);
}
}

View File

@ -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);
// }
/**

View File

@ -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);

View File

@ -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<RlUserWithdraw> 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<RlUserWithdraw> list = rlUserWithdrawService.selectRlUserWithdrawList(rlUserWithdraw);
ExcelUtil<RlUserWithdraw> util = new ExcelUtil<RlUserWithdraw>(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));
}
}

View File

@ -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;
}

View File

@ -139,5 +139,9 @@ public enum BusinessType
/**
* 保存店铺
*/
SAVESTORE
SAVESTORE,
/**
* 上传收款码
*/
UPLOADQRCODE,
}

View File

@ -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<ChannelWithdrawVO> 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登录信息
*

View File

@ -53,4 +53,8 @@ public class ChannelWithdraw extends BaseEntity
@Min(value = 0, message = "单笔最高提现金额不能小于0")
private BigDecimal maxAmount;
/** 是否需要上传收款码0-不需要1-需要 */
@Excel(name = "是否需要上传收款码")
private String isNeedCode;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -0,0 +1,7 @@
package com.ruoyi.system.domain.userWithdraw;
import lombok.Data;
@Data
public class RlUserWithdrawQuery extends RlUserWithdraw{
}

View File

@ -0,0 +1,8 @@
package com.ruoyi.system.domain.userWithdraw;
import lombok.Data;
@Data
public class RlUserWithdrawVO extends RlUserWithdraw{
}

View File

@ -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;

View File

@ -31,6 +31,8 @@ public interface RlChannelWithdrawMapper
*/
public List<ChannelWithdrawVO> selectChannelWithdrawList(@Param("query") ChannelWithdrawQuery query);
/**
* 新增提现渠道
*
@ -62,4 +64,11 @@ public interface RlChannelWithdrawMapper
* @return 结果
*/
public int deleteChannelWithdrawByChannelIds(Long[] channelIds);
/**
* 查询所有提现渠道列表
*
* @return 提现渠道
*/
List<ChannelWithdrawVO> selectAllChannelWithdrawList();
}

View File

@ -199,4 +199,9 @@ public interface RlUserMapper
* 更新用户余额
*/
int changeBalance(@Param("changeAmount")BigDecimal changeAmount,@Param("userId")Long userId);
/**
* 获取今日订单金额
*/
BigDecimal selectTodayOrderAmount(Long userId);
}

View File

@ -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<RlUserWithdraw> 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<RlUserWithdraw> selectRlUserWithdrawListByUserId(Long userId);
}

View File

@ -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<RlUserWithdraw> selectRlUserWithdrawList(RlUserWithdraw rlUserWithdraw);
/**
* 根据userId查询用户提现渠道列表
*
* @param userId 用户id
* @return 用户提现渠道集合
*/
public List<RlUserWithdraw> 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);
}

View File

@ -31,6 +31,13 @@ public interface RlChannelWithdrawService
*/
public List<ChannelWithdrawVO> selectChannelWithdrawList(ChannelWithdrawQuery channelWithdraw);
/**
* 查询所有提现渠道列表
*
* @return 提现渠道集合
*/
public List<ChannelWithdrawVO> selectAllChannelWithdrawList();
/**
* 新增提现渠道
*

View File

@ -49,6 +49,16 @@ public class RlChannelWithdrawServiceImpl implements RlChannelWithdrawService
return rlChannelWithdrawMapper.selectChannelWithdrawList(channelWithdraw);
}
/**
* 查询所有提现渠道列表
*
* @return 提现渠道
*/
@Override
public List<ChannelWithdrawVO> selectAllChannelWithdrawList() {
return rlChannelWithdrawMapper.selectAllChannelWithdrawList();
}
/**
* 新增提现渠道
*

View File

@ -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("新增记录提现记录失败");

View File

@ -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<RlUserWithdraw> selectRlUserWithdrawList(RlUserWithdraw rlUserWithdraw)
{
return rlUserWithdrawMapper.selectRlUserWithdrawList(rlUserWithdraw);
}
/**
* 根据userId查询用户提现渠道列表
*
* @param userId 用户id
* @return 用户提现渠道集合
*/
@Override
public List<RlUserWithdraw> 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);
}
}

View File

@ -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<StoreVo> nearbyStores = allStores.stream()
.map(store -> {
List<RlModelVO> 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;

View File

@ -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
</sql>
@ -42,6 +43,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where channel_id = #{channelId}
</select>
<select id="selectAllChannelWithdrawList" resultMap="ChannelWithdrawResult">
<include refid="selectChannelWithdrawVo"/> where scw.enabled != 0
</select>
<insert id="insertChannelWithdraw" parameterType="ChannelWithdraw" useGeneratedKeys="true" keyProperty="channelId">
insert into rl_channel_withdraw
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -53,6 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="picture != null">picture,</if>
<if test="minAmount != null">min_amount,</if>
<if test="maxAmount != null">max_amount,</if>
<if test="isNeedCode != null">is_need_code,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">#{name},</if>
@ -63,6 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="picture != null">#{picture},</if>
<if test="minAmount != null">#{minAmount},</if>
<if test="maxAmount != null">#{maxAmount},</if>
<if test="isNeedCode != null">#{isNeedCode},</if>
</trim>
</insert>
@ -77,6 +84,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<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>
<if test="data.isNeedCode != null">is_need_code = #{data.isNeedCode},</if>
</trim>
where channel_id = #{data.channelId}
</update>

View File

@ -201,6 +201,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where user_id = #{userId}
</select>
<select id="selectTodayOrderAmount" resultType="java.math.BigDecimal">
SELECT
COALESCE(SUM(CASE WHEN type = '1' THEN amount ELSE 0 END), 0) -
COALESCE(SUM(CASE WHEN type = '2' THEN amount ELSE 0 END), 0) AS net_amount
FROM
rl_change_balance
WHERE
DATE(create_time) = CURDATE()
AND owner_id = #{ownerId}
</select>
<insert id="insertUser" parameterType="RlUser" useGeneratedKeys="true" keyProperty="userId">
insert into rl_user(
<if test="userId != null and userId != 0">user_id,</if>

View File

@ -0,0 +1,102 @@
<?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.RlUserWithdrawMapper">
<resultMap type="RlUserWithdrawVO" id="RlUserWithdrawResult" autoMapping="true" />
<sql id="selectRlUserWithdrawVo">
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
</sql>
<select id="selectRlUserWithdrawList" parameterType="RlUserWithdraw" resultMap="RlUserWithdrawResult">
<include refid="selectRlUserWithdrawVo"/>
<where>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="channelId != null "> and channel_id = #{channelId}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="handlingChargeType != null and handlingChargeType != ''"> and handling_charge_type = #{handlingChargeType}</if>
<if test="withdrawHandlingCharge != null "> and withdraw_handling_charge = #{withdrawHandlingCharge}</if>
<if test="minAmount != null "> and min_amount = #{minAmount}</if>
<if test="maxAmount != null "> and max_amount = #{maxAmount}</if>
<if test="isOpen != null and isOpen != ''"> and is_open = #{isOpen}</if>
</where>
</select>
<select id="selectRlUserWithdrawByUserChannelId" parameterType="Long" resultMap="RlUserWithdrawResult">
<include refid="selectRlUserWithdrawVo"/>
where user_channel_id = #{userChannelId}
</select>
<select id="selectRlUserWithdrawListByUserId" parameterType="Long" resultMap="RlUserWithdrawResult">
<include refid="selectRlUserWithdrawVo"/>
where user_id = #{userId}
</select>
<insert id="insertRlUserWithdraw" parameterType="RlUserWithdraw">
insert into rl_user_withdraw
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userChannelId != null">user_channel_id,</if>
<if test="userId != null">user_id,</if>
<if test="channelId != null">channel_id,</if>
<if test="name != null and name != ''">name,</if>
<if test="handlingChargeType != null">handling_charge_type,</if>
<if test="withdrawHandlingCharge != null">withdraw_handling_charge,</if>
<if test="minAmount != null">min_amount,</if>
<if test="maxAmount != null">max_amount,</if>
<if test="createTime != null">create_time,</if>
<if test="isOpen != null">is_open,</if>
<if test="picture != null">picture,</if>
<if test="collectionCode != null">collection_code,</if>
<if test="isNeedCode != null">is_need_code,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userChannelId != null">#{userChannelId},</if>
<if test="userId != null">#{userId},</if>
<if test="channelId != null">#{channelId},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="handlingChargeType != null">#{handlingChargeType},</if>
<if test="withdrawHandlingCharge != null">#{withdrawHandlingCharge},</if>
<if test="minAmount != null">#{minAmount},</if>
<if test="maxAmount != null">#{maxAmount},</if>
<if test="createTime != null">#{createTime},</if>
<if test="isOpen != null">#{isOpen},</if>
<if test="picture != null">#{picture},</if>
<if test="collectionCode != null">#{collectionCode},</if>
<if test="isNeedCode != null">#{isNeedCode},</if>
</trim>
</insert>
<update id="updateRlUserWithdraw" parameterType="RlUserWithdraw">
update rl_user_withdraw
<trim prefix="SET" suffixOverrides=",">
<if test="userId != null">user_id = #{userId},</if>
<if test="channelId != null">channel_id = #{channelId},</if>
<if test="name != null and name != ''">name = #{name},</if>
<if test="handlingChargeType != null">handling_charge_type = #{handlingChargeType},</if>
<if test="withdrawHandlingCharge != null">withdraw_handling_charge = #{withdrawHandlingCharge},</if>
<if test="minAmount != null">min_amount = #{minAmount},</if>
<if test="maxAmount != null">max_amount = #{maxAmount},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="isOpen != null">is_open = #{isOpen},</if>
<if test="picture != null">picture = #{picture},</if>
<if test="collectionCode != null">collection_code = #{collectionCode},</if>
<if test="isNeedCode != null">is_need_code = #{isNeedCode},</if>
</trim>
where user_channel_id = #{userChannelId}
</update>
<delete id="deleteRlUserWithdrawByUserChannelId" parameterType="Long">
delete from rl_user_withdraw where user_channel_id = #{userChannelId}
</delete>
<delete id="deleteRlUserWithdrawByUserChannelIds" parameterType="String">
delete from rl_user_withdraw where user_channel_id in
<foreach item="userChannelId" collection="array" open="(" separator="," close=")">
#{userChannelId}
</foreach>
</delete>
</mapper>