分销退款问题
This commit is contained in:
@@ -26,8 +26,6 @@ import com.czg.market.vo.InviteUserVO;
|
||||
import com.czg.market.vo.MkDistributionConfigVO;
|
||||
import com.czg.order.dto.MkDistributionPayDTO;
|
||||
import com.czg.order.entity.OrderInfo;
|
||||
import com.czg.market.service.OrderInfoService;
|
||||
import com.czg.order.service.OrderPaymentService;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.service.market.enums.OrderStatusEnums;
|
||||
import com.czg.service.market.mapper.MkDistributionUserMapper;
|
||||
@@ -685,22 +683,15 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
|
||||
.ne(MkDistributionFlow::getStatus, TableValueConstant.DistributionFlow.Status.REFUND.getCode()));
|
||||
|
||||
list.forEach(item -> {
|
||||
MkDistributionFlow refundFlow = BeanUtil.copyProperties(item, MkDistributionFlow.class);
|
||||
refundFlow.setStatus(TableValueConstant.DistributionFlow.Status.REFUND.getCode());
|
||||
refundFlow.setSourceId(item.getId());
|
||||
refundFlow.setId(null);
|
||||
refundFlow.setCreateTime(DateUtil.date().toLocalDateTime());
|
||||
refundFlow.setUpdateTime(DateUtil.date().toLocalDateTime());
|
||||
if (TableValueConstant.DistributionFlow.Status.PENDING.getCode().equals(item.getStatus())) {
|
||||
item.setStatus(TableValueConstant.DistributionFlow.Status.SUCCESS.getCode());
|
||||
// updateIncome(item.getRewardAmount().negate(), BigDecimal.ZERO, BigDecimal.ZERO, item.getDistributionUserId(), item.getUserId(), item.getShopUserId(), item.getShopId(), item.getLevel());
|
||||
item.setStatus(TableValueConstant.DistributionFlow.Status.REFUND.getCode());
|
||||
distributionFlowService.updateById(item);
|
||||
mapper.updateIncome(item.getRewardAmount().negate(), null, null, item.getDistributionUserId(), item.getShopId());
|
||||
} else {
|
||||
// 执行扣款
|
||||
updateIncome(BigDecimal.ZERO, item.getRewardAmount().negate(), BigDecimal.ZERO, item.getDistributionUserId(), item.getUserId(), item.getShopUserId(), item.getShopId(), item.getLevel());
|
||||
updateShopInfoAmount(item.getShopId(), item.getRewardAmount(), orderId, TableValueConstant.DistributionAmountFlow.Type.REFUND, "分销回退");
|
||||
}
|
||||
distributionFlowService.save(refundFlow);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -738,6 +729,13 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
|
||||
distributionDeliverService.save(deliver);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分销金额修改
|
||||
*
|
||||
* @param pendingIncome 待入账金额
|
||||
* @param receivedIncome 已入账
|
||||
* @param withdrawIncome 已提现
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateIncome(BigDecimal pendingIncome, BigDecimal receivedIncome, BigDecimal withdrawIncome, Long id, Long userId, Long shopUserId, Long shopId, Integer isOne) {
|
||||
|
||||
@@ -45,36 +45,33 @@
|
||||
order by a.create_time desc
|
||||
</select>
|
||||
<select id="totalAmount" resultType="java.math.BigDecimal">
|
||||
select sum(a.amount) from mk_distribution_flow as a
|
||||
left join mk_distribution_user as d on d.id=a.distribution_user_id
|
||||
left join tb_shop_user as b on a.shop_user_id=b.id
|
||||
left join tb_shop_user as c on c.id=a.shop_user_id
|
||||
select sum(a.reward_amount)
|
||||
from mk_distribution_flow as a
|
||||
left join tb_shop_user as b on a.shop_user_id = b.id
|
||||
where a.shop_id=#{shopId}
|
||||
<if test="id != null">
|
||||
and a.shop_user_id=#{id}
|
||||
</if>
|
||||
<if test="userId != null">
|
||||
and a.user_id=#{userId}
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
and a.status=#{status}
|
||||
</if>
|
||||
<if test="type != null and type != ''">
|
||||
and a.type=#{type}
|
||||
</if>
|
||||
<if test="startTime != null">
|
||||
and a.create_time>=#{startTime}
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
and a.create_time<=#{endTime}
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
and a.status=#{status}
|
||||
</if>
|
||||
<if test="key != null and key != ''">
|
||||
and (
|
||||
b.nick_name like concat('%',#{key},'%')
|
||||
or b.id like concat('%',#{key},'%')
|
||||
or c.id like concat('%',#{key},'%')
|
||||
or c.nick_name like concat('%',#{key},'%')
|
||||
)
|
||||
</if>
|
||||
<if test="id != null">
|
||||
and d.id=#{id}
|
||||
</if>
|
||||
<if test="type != null and type != ''">
|
||||
and a.type=#{type}
|
||||
</if>
|
||||
<if test="userId != null">
|
||||
and d.user_id=#{userId}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user