临时提交

This commit is contained in:
墨大叔 2024-09-15 17:04:26 +08:00
parent dba95cd81f
commit 667d021142
16 changed files with 87 additions and 9 deletions

View File

@ -185,4 +185,8 @@ public class SmUser extends BaseEntity
@Excel(name = "代理商服务费比例")
@ApiModelProperty("代理商服务费比例")
private BigDecimal agentServiceRate;
@Excel(name = "到账延迟时间", readConverterExp = "小=时")
@ApiModelProperty("到账延迟时间")
private Long arrivalDelay;
}

View File

@ -22,6 +22,9 @@ public class SybConfig {
// 应用ID
private String appId;
// 子应用ID
private String subAppId;
// MD5密钥
private String md5AppKey;

View File

@ -47,7 +47,7 @@ public class SybPayService {
"",
"",
"",
"",
sybConfig.getSubAppId(),
"",
"",
"",

View File

@ -20,7 +20,8 @@ public enum ConfigKey {
DAILY_WITHDRAW_AMOUNT("daily.withdraw.amount", "单日单用户提现限额(元)"),
DAILY_WITHDRAW_COUNT("daily.withdraw.count", "单日单用户提现次数(次)"),
NOVERIFY_WITHDRAW_SINGLE("noverify.withdraw.single", "提现单笔免审核额度(元)"),
RECHARGE_MIN_SERVICE("recharge.min.service","充值最低服务费(元)");
RECHARGE_MIN_SERVICE("recharge.min.service","充值最低服务费(元)"),
ARRIVAL_DELAY("arrival.delay", "延迟到账时间(小时)");
private final String key;
private final String msg;

View File

@ -107,4 +107,11 @@ public interface ISysConfigService
List<SysConfig> selectByIds(List<Long> configIds);
int batchUpdateValue(List<SysConfig> list);
/**
* 获取int配置
* @param key
* @return
*/
int getInt(ConfigKey key);
}

View File

@ -275,6 +275,19 @@ public class SysConfigServiceImpl implements ISysConfigService
return result == null ? 0 : result;
}
@Override
public int getInt(ConfigKey key) {
String s = this.selectConfigByKey(key.getKey());
if (StringUtils.isBlank(s)) {
return 0;
}
try {
return Integer.parseInt(s);
} catch (Exception e) {
return 0;
}
}
/**
* 设置cache key
*

View File

@ -2,6 +2,7 @@ package com.ruoyi.ss.bonus.service.impl;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@ -22,7 +23,10 @@ import com.ruoyi.ss.bonus.domain.vo.BonusMonthAmountVO;
import com.ruoyi.ss.bonus.domain.vo.ProvideBonusVO;
import com.ruoyi.ss.recordBalance.domain.enums.RecordBalanceBstType;
import com.ruoyi.ss.store.service.StoreService;
import com.ruoyi.ss.user.domain.SmUserVo;
import com.ruoyi.ss.user.service.ISmUserService;
import com.ruoyi.system.domain.enums.config.ConfigKey;
import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.system.service.ISysDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -57,6 +61,9 @@ public class BonusServiceImpl implements BonusService
@Autowired
private StoreService storeService;
@Autowired
private ISysConfigService sysConfigService;
/**
* 查询分成明细
*
@ -184,12 +191,32 @@ public class BonusServiceImpl implements BonusService
BigDecimal decimal100 = new BigDecimal(100);
BigDecimal dividedAmount = BigDecimal.ZERO; // 已分配金额
// 获取用户列表
List<SmUserVo> userList = userService.selectByUserIds(bonusList.stream()
.filter(item -> BonusArrivalType.userList().contains(item.getArrivalType()))
.map(BonusVO::getArrivalId)
.collect(Collectors.toList())
);
// 获取全局配置默认延迟到账时间
int defaultDelay = sysConfigService.getInt(ConfigKey.ARRIVAL_DELAY);
LocalDateTime now = LocalDateTime.now();
LocalDateTime defaultPrePayTime = now.plusHours(defaultDelay);
// 循环遍历构造分成金额
for (BonusVO bonus : bonusList) {
BigDecimal amount = money.multiply(bonus.getPoint()).divide(decimal100, 2, RoundingMode.HALF_UP);
bonus.setAmount(amount);
bonus.setStatus(BonusStatus.WAIT_DIVIDE.getStatus());
// TODO 预计分成时间
if (BonusArrivalType.userList().contains(bonus.getArrivalType())) {
SmUserVo user = userList.stream().filter(item -> item.getUserId().equals(bonus.getArrivalId())).findFirst().orElse(null);
bonus.setPrePayTime();
} else {
bonus.setPrePayTime(now);
}
dividedAmount = dividedAmount.add(amount);
}
// 平台吃掉误差

View File

@ -807,6 +807,11 @@ public class DeviceServiceImpl implements DeviceService
}
}
ServiceUtil.assertion(device.getLimitRechargeTime() != null
&& device.getLimitRechargeTime().isAfter(LocalDateTime.now()),
"设备无法绑定:" + device.getLimitRechargeReason()
);
// 查询用户
SmUserVo user = userService.selectSimpleById(userId);
ServiceUtil.assertion(user == null, "用户不存在");

View File

@ -36,9 +36,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="query.userType != null and query.userType != ''"> and sr.user_type = #{query.userType}</if>
<if test="query.userId != null "> and sr.user_id = #{query.userId}</if>
<if test="query.userName != null and query.userName != ''"> and sr.user_name like concat('%', #{query.userName}, '%')</if>
<if test="query.billMchId != null "> and smb.mch_id = #{query.billMchId}</if>
<if test="query.bstType != null and query.bstType != ''"> and bst_type = #{query.bstType}</if>
<if test="query.channelId != null "> and channel_id = #{query.channelId}</if>
<if test="query.bstType != null and query.bstType != ''"> and sr.bst_type = #{query.bstType}</if>
<if test="query.channelId != null "> and sr.channel_id = #{query.channelId}</if>
</sql>
<select id="selectRefundList" parameterType="Refund" resultMap="RefundResult">

View File

@ -874,10 +874,6 @@ public class TransactionBillServiceImpl implements TransactionBillService, After
// 处理分成
bonusService.partBonus(bill.getBonusList(), bill.getMoney());
// 记录下充值后的余额
SmUserVo user = userService.selectSmUserByUserId(bill.getMchId());
updateAfterBalance(bill.getBillId(), user.getBalance());
return updateCount;
});

View File

@ -48,6 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
su.limit_withdraw,
su.limit_withdraw_reason,
su.agent_service_rate,
su.arrival_delay,
if(su.is_real, su.real_name, su.user_name) as real_or_user_name,
(select sum(stb.money) from sm_transaction_bill stb where stb.user_id = su.user_id and stb.type = '1' and stb.status = '2') as recharge_amount,
(select sum(stb.arrival_amount) from sm_transaction_bill stb where stb.user_id = su.user_id and stb.type = '2' and stb.status = '14') as with_drawl_amount,
@ -166,6 +167,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isReal != null">is_real,</if>
<if test="limitWithdraw != null">limit_withdraw,</if>
<if test="limitWithdrawReason != null">limit_withdraw_reason,</if>
<if test="arrivalDelay != null">arrival_delay,</if>
<if test="agentServiceRate != null">agent_service_rate,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
@ -202,6 +204,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isReal != null">#{isReal},</if>
<if test="limitWithdraw != null">#{limitWithdraw},</if>
<if test="limitWithdrawReason != null">#{limitWithdrawReason},</if>
<if test="arrivalDelay != null">arrival_delay,</if>
<if test="agentServiceRate != null">#{agentServiceRate},</if>
</trim>
</insert>
@ -248,6 +251,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isReal != null">is_real = #{isReal},</if>
<if test="limitWithdraw != null">limit_withdraw = #{limitWithdraw},</if>
<if test="limitWithdrawReason != null">limit_withdraw_reason = #{limitWithdrawReason},</if>
<if test="arrivalDelay != null">arrival_delay = #{arrivalDelay},</if>
<if test="agentServiceRate != null">agent_service_rate = #{agentServiceRate},</if>
</trim>
where user_id = #{userId}

View File

@ -6,9 +6,11 @@ import com.ruoyi.ss.recordBalance.domain.enums.RecordBalanceBstType;
import com.ruoyi.ss.user.domain.SmUserQuery;
import com.ruoyi.ss.user.domain.SmUserVo;
import com.ruoyi.ss.user.domain.dto.UserRealNameDTO;
import nonapi.io.github.classgraph.utils.LogNode;
import java.math.BigDecimal;
import java.util.List;
import java.util.stream.Stream;
/**
* 普通用户信息Service接口
@ -209,4 +211,9 @@ public interface ISmUserService
* 实名认证
*/
int realName(UserRealNameDTO dto);
/**
* 根据用户ID列表查询
*/
List<SmUserVo> selectByUserIds(List<Long> userIds);
}

View File

@ -299,6 +299,13 @@ public class SmUserServiceImpl implements ISmUserService
return smUserMapper.updateSmUser(data);
}
@Override
public List<SmUserVo> selectByUserIds(List<Long> userIds) {
SmUserQuery query = new SmUserQuery();
query.setUserIds(userIds);
return smUserMapper.selectSmUserList(query);
}
/**
* 逻辑删除前校验
* @param userIds

View File

@ -72,6 +72,7 @@ public class MchStoreApplyController extends BaseController {
query.setUserId(getUserId());
return getDataTable(storeApplyService.selectStoreApplyList(query));
}
@ApiOperation("查询本人提交的店铺申请详情")
@GetMapping("/{id}")
public AjaxResult detail(@PathVariable Long id) {

View File

@ -90,6 +90,8 @@ syb:
cusId: 56340307399QTL2
# 应用ID
appId: "00322693"
# 子应用ID
subAppId: ${wx.appid}
# MD5密钥
md5AppKey: allinpay888
# Api地址

View File

@ -91,6 +91,8 @@ syb:
cusId: 56340307399QTL2
# 应用ID
appId: "00322693"
# 子应用ID
subAppId: ${wx.appid}
# MD5密钥
md5AppKey: allinpay888
# Api地址