debug人工退款金额

This commit is contained in:
磷叶 2025-04-28 14:15:32 +08:00
parent 63f4f05089
commit 3f2a845c44
8 changed files with 42 additions and 29 deletions

View File

@ -188,6 +188,7 @@ public class LogAspect
if (loginUser != null)
{
operLog.setOperName(loginUser.getNickName());
operLog.setOperUserId(loginUser.getUserId());
UserVO currentUser = loginUser.getUser();
if (StringUtils.isNotNull(currentUser) && StringUtils.isNotNull(currentUser.getDept()))
{

View File

@ -1,5 +1,10 @@
package com.ruoyi.framework.manager.factory;
import java.util.TimerTask;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.utils.LogUtils;
import com.ruoyi.common.utils.ServletUtils;
@ -8,14 +13,11 @@ import com.ruoyi.common.utils.ip.AddressUtils;
import com.ruoyi.common.utils.ip.IpUtils;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.system.logininfor.domain.Logininfor;
import com.ruoyi.system.logininfor.service.LogininforService;
import com.ruoyi.system.operLog.domain.OperLog;
import com.ruoyi.system.operLog.service.OperLogService;
import com.ruoyi.system.logininfor.service.LogininforService;
import eu.bitwalker.useragentutils.UserAgent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.TimerTask;
import eu.bitwalker.useragentutils.UserAgent;
/**
* 异步工厂产生任务用

View File

@ -520,27 +520,28 @@ public class OrderServiceImpl implements OrderService
// 退款原因
String refundReason = null;
if (RefundType.ADMIN.getCode().equals(type)) {
reason = String.format("【管理员退款】%s订单%s退款 %s 元", userName, order.getNo(), amount);
refundReason = String.format("【管理员退款】%s订单%s退款 %s 元", userName, order.getNo(), amount);
} else {
reason = String.format("【自动退款】%s订单%s退款 %s 元", userName, order.getNo(), amount);
refundReason = String.format("【自动退款】%s订单%s退款 %s 元", userName, order.getNo(), amount);
}
if (StringUtils.isNotBlank(reason)) {
reason += "" + reason;
refundReason += "" + reason;
}
String refundReason = reason;
String finalRefundReason = refundReason;
Integer result = transactionTemplate.execute(status -> {
// 分成退款
boolean bonusRefund = bonusService.refundByBst(BonusBstType.ORDER, order.getId(), amount, order.getPayAmount(), refundReason);
boolean bonusRefund = bonusService.refundByBst(BonusBstType.ORDER, order.getId(), amount, order.getPayAmount(), finalRefundReason);
ServiceUtil.assertion(!bonusRefund, "ID为%s的订单分成退款失败", order.getId());
// 支付退款
PayRefundDTO dto = new PayRefundDTO();
dto.setId(order.getPayId());
dto.setRefundAmount(amount);
dto.setRefundReason(refundReason);
dto.setRefundReason(finalRefundReason);
dto.setUserId(userId);
dto.setUserName(userName);
dto.setType(type);

View File

@ -83,7 +83,7 @@ public interface PayMapper
* @param amount 退款金额
* @return 结果
*/
int addRefundingAmount(@Param("id") Long id, @Param("amount") BigDecimal amount, @Param("type") String type);
int addRefundingAmount(@Param("id") Long id, @Param("amount") BigDecimal amount, @Param("refundType") String refundType);
/**
* 记录退款金额

View File

@ -73,7 +73,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where bp.id = #{id}
</select>
<insert id="insertPay" parameterType="Pay" useGeneratedKeys="true" keyProperty="id">
insert into bst_pay
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -186,17 +186,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update bst_pay
<trim prefix="SET" suffixOverrides=",">
refunding = refunding + #{amount},
<if test="type != null and type == '1'">
auto_refund = auto_refund + #{amount},
</if>
<if test="type != null and type == '2'">
admin_refund = admin_refund + #{amount},
</if>
auto_refund = if(#{refundType} = '1', auto_refund + #{amount}, auto_refund),
admin_refund = if(#{refundType} = '2', admin_refund + #{amount}, admin_refund),
</trim>
where id = #{id} and amount >= refunded + refunding + #{amount}
</insert>
<!-- recordRefundAmount -->
<!-- recordRefundAmount -->
<update id="recordRefundAmount">
update bst_pay
@ -205,7 +201,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id} and refunding - #{amount} >= 0
</update>
<!-- selectNoList -->
<!-- selectNoList -->
<select id="selectNoList" parameterType="PayQuery" resultType="String">
select bp.no
@ -215,7 +211,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
</select>
<!-- selectSumofAmount -->
<!-- selectSumofAmount -->
<select id="selectSumofAmount">
select sum(bp.amount)
@ -226,7 +222,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<!-- selectSumOfChannelCost -->
<!-- selectSumOfChannelCost -->
<select id="selectSumOfChannelCost">
select sum(bp.channel_cost)

View File

@ -97,4 +97,8 @@ public class OperLog extends BaseEntity
@Excel(name = "业务类型")
private String bizType;
/** 操作人ID */
@Excel(name = "操作人ID")
private Long operUserId;
}

View File

@ -28,7 +28,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
oper_time,
cost_time,
biz_ids,
biz_type
biz_type,
oper_user_id
from sys_oper_log
</sql>
@ -51,10 +52,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
cost_time,
oper_time,
biz_ids,
biz_type
biz_type,
oper_user_id
)
values (
#{title},
values (
#{title},
#{businessType},
#{method},
#{requestMethod},
@ -71,8 +73,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{costTime},
sysdate(),
#{bizIds,typeHandler=com.ruoyi.common.mybatis.typehandler.StringSplitListTypeHandler},
#{bizType}
)
#{bizType},
#{operUserId}
)
</insert>
<select id="selectOperLogList" parameterType="OperLogQuery" resultMap="SysOperLogResult">
@ -114,6 +117,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
AND oper_time &lt;= #{params.endTime}
</if>
<if test="operUserId != null">
and oper_user_id = #{operUserId}
</if>
<if test="operTimeRange != null and operTimeRange.size() > 1">
AND oper_time &gt;= #{operTimeRange[0]}
AND oper_time &lt;= #{operTimeRange[1]}

View File

@ -10,6 +10,7 @@ import com.ruoyi.bst.area.domain.AreaVO;
import com.ruoyi.bst.area.service.AreaService;
import com.ruoyi.bst.customerService.domain.CustomerServiceQuery;
import com.ruoyi.bst.customerService.domain.dto.CustomerServiceIndexQuery;
import com.ruoyi.bst.customerService.domain.enums.CustomerServiceStatus;
import com.ruoyi.bst.customerService.service.CustomerServiceService;
import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.controller.BaseController;
@ -55,6 +56,7 @@ public class AppCustomerServiceController extends BaseController {
if (areaId != null) {
CustomerServiceQuery afterQuery = new CustomerServiceQuery();
afterQuery.setAreaId(areaId);
afterQuery.setIsEnabled(CustomerServiceStatus.ENABLE.getStatus());
ajax.put("after", customerServiceService.selectCustomerServiceList(afterQuery));
}
@ -70,6 +72,7 @@ public class AppCustomerServiceController extends BaseController {
// 查询运营区客服
CustomerServiceQuery beforeQuery = new CustomerServiceQuery();
beforeQuery.setAreaId(area.getId());
beforeQuery.setIsEnabled(CustomerServiceStatus.ENABLE.getStatus());
ajax.put("before", customerServiceService.selectCustomerServiceList(beforeQuery));
}
}