1.优化分销员计算一级、二级分销佣金业务
2.优化送水订单获取用户收货地址业务 3.优化收益明细订单号、用户ID查询业务 4.提现业务增加订单号,避免使用订单ID传入会与生产ID重复,导致都是已使用订单号
This commit is contained in:
@@ -329,16 +329,14 @@ public class GltTicketOrderController extends BaseController {
|
|||||||
if (addr == null) {
|
if (addr == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (StrUtil.isNotBlank(addr.getFullAddress())) {
|
|
||||||
return addr.getFullAddress();
|
|
||||||
}
|
|
||||||
// 兼容旧数据:fullAddress 为空时,拼接省市区 + 详细地址
|
// 兼容旧数据:fullAddress 为空时,拼接省市区 + 详细地址
|
||||||
return StrUtil.blankToDefault(
|
return StrUtil.blankToDefault(
|
||||||
StrUtil.join("",
|
StrUtil.join("",
|
||||||
StrUtil.nullToEmpty(addr.getProvince()),
|
StrUtil.nullToEmpty(addr.getProvince()),
|
||||||
StrUtil.nullToEmpty(addr.getCity()),
|
StrUtil.nullToEmpty(addr.getCity()),
|
||||||
StrUtil.nullToEmpty(addr.getRegion()),
|
StrUtil.nullToEmpty(addr.getRegion()),
|
||||||
StrUtil.nullToEmpty(addr.getAddress())
|
StrUtil.nullToEmpty(addr.getAddress()),
|
||||||
|
StrUtil.nullToEmpty(addr.getFullAddress())
|
||||||
),
|
),
|
||||||
addr.getAddress()
|
addr.getAddress()
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import com.gxwebsoft.shop.mapper.ShopDealerRefereeMapper;
|
|||||||
import com.gxwebsoft.shop.mapper.ShopOrderMapper;
|
import com.gxwebsoft.shop.mapper.ShopOrderMapper;
|
||||||
import com.gxwebsoft.shop.service.*;
|
import com.gxwebsoft.shop.service.*;
|
||||||
import com.gxwebsoft.shop.util.UpstreamUserFinder;
|
import com.gxwebsoft.shop.util.UpstreamUserFinder;
|
||||||
|
import com.gxwebsoft.shop.vo.ShopDealerRefereeVO;
|
||||||
import com.gxwebsoft.shop.vo.ShopOrderGoodsVO;
|
import com.gxwebsoft.shop.vo.ShopOrderGoodsVO;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
@@ -484,16 +485,23 @@ public class DealerOrderSettlement10584Task {
|
|||||||
AtomicReference<BigDecimal> simpleMoney = new AtomicReference<>(BigDecimal.ZERO);
|
AtomicReference<BigDecimal> simpleMoney = new AtomicReference<>(BigDecimal.ZERO);
|
||||||
|
|
||||||
|
|
||||||
if (dealerLevel >= 1) {
|
ShopDealerRefereeVO dealerRefereeVO = shopDealerRefereeMapper.getDealerIdByUserId(order.getUserId());
|
||||||
Integer dealerId = shopDealerRefereeMapper.getDealerIdByUserId(order.getUserId());
|
if (dealerLevel == 1) {
|
||||||
if(dealerId != null){
|
Integer directUserId = dealerRefereeVO.getDirectUserId();
|
||||||
directDealerId = dealerId;
|
Integer directUserType = dealerRefereeVO.getDirectUserType();
|
||||||
|
if(directUserId != null && directUserType != null && directUserType == 0){
|
||||||
|
directDealerId = dealerRefereeVO.getDirectUserId();
|
||||||
}
|
}
|
||||||
}
|
}else {
|
||||||
if (dealerLevel >= 2 && directDealerId != null) {
|
Integer directUserId = dealerRefereeVO.getDirectUserId();
|
||||||
Integer dealerId = shopDealerRefereeMapper.getDealerIdByUserId(directDealerId);
|
Integer directUserType = dealerRefereeVO.getDirectUserType();
|
||||||
if(dealerId != null){
|
Integer simpleUserId = dealerRefereeVO.getSimpleUserId();
|
||||||
simpleDealerId = dealerId;
|
Integer simpleUserType = dealerRefereeVO.getSimpleUserType();
|
||||||
|
if(directUserId != null && directUserType != null && directUserType == 0){
|
||||||
|
directDealerId = directUserId;
|
||||||
|
}
|
||||||
|
if(simpleUserId != null && simpleUserType != null && simpleUserType == 0){
|
||||||
|
simpleDealerId = simpleUserId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
package com.gxwebsoft.shop.controller;
|
package com.gxwebsoft.shop.controller;
|
||||||
|
|
||||||
|
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||||
|
import com.gxwebsoft.common.core.web.ApiResult;
|
||||||
import com.gxwebsoft.common.core.web.BaseController;
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
import com.gxwebsoft.shop.service.ShopDealerCapitalService;
|
import com.gxwebsoft.common.core.web.BatchParam;
|
||||||
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
|
import com.gxwebsoft.common.system.entity.User;
|
||||||
import com.gxwebsoft.shop.entity.ShopDealerCapital;
|
import com.gxwebsoft.shop.entity.ShopDealerCapital;
|
||||||
import com.gxwebsoft.shop.param.ShopDealerCapitalParam;
|
import com.gxwebsoft.shop.param.ShopDealerCapitalParam;
|
||||||
import com.gxwebsoft.common.core.web.ApiResult;
|
import com.gxwebsoft.shop.service.ShopDealerCapitalService;
|
||||||
import com.gxwebsoft.common.core.web.PageResult;
|
|
||||||
import com.gxwebsoft.common.core.web.PageParam;
|
|
||||||
import com.gxwebsoft.common.core.web.BatchParam;
|
|
||||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
|
||||||
import com.gxwebsoft.common.system.entity.User;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.springdoc.api.annotations.ParameterObject;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ public class ShopDealerCapitalController extends BaseController {
|
|||||||
@PreAuthorize("hasAuthority('shop:shopDealerCapital:list')")
|
@PreAuthorize("hasAuthority('shop:shopDealerCapital:list')")
|
||||||
@Operation(summary = "分页查询分销商资金明细表")
|
@Operation(summary = "分页查询分销商资金明细表")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<PageResult<ShopDealerCapital>> page(ShopDealerCapitalParam param) {
|
public ApiResult<PageResult<ShopDealerCapital>> page(@ParameterObject ShopDealerCapitalParam param) {
|
||||||
// 使用关联查询
|
// 使用关联查询
|
||||||
return success(shopDealerCapitalService.pageRel(param));
|
return success(shopDealerCapitalService.pageRel(param));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.gxwebsoft.shop.controller;
|
|||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.gxwebsoft.common.core.web.BaseController;
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
|
import com.gxwebsoft.common.system.redis.OrderNoUtils;
|
||||||
import com.gxwebsoft.shop.entity.ShopDealerUser;
|
import com.gxwebsoft.shop.entity.ShopDealerUser;
|
||||||
import com.gxwebsoft.shop.service.ShopDealerUserService;
|
import com.gxwebsoft.shop.service.ShopDealerUserService;
|
||||||
import com.gxwebsoft.shop.service.ShopDealerWithdrawService;
|
import com.gxwebsoft.shop.service.ShopDealerWithdrawService;
|
||||||
@@ -43,6 +44,8 @@ public class ShopDealerWithdrawController extends BaseController {
|
|||||||
private ShopDealerUserService shopDealerUserService;
|
private ShopDealerUserService shopDealerUserService;
|
||||||
@Resource
|
@Resource
|
||||||
private WxTransferService wxTransferService;
|
private WxTransferService wxTransferService;
|
||||||
|
@Resource
|
||||||
|
private OrderNoUtils orderNoUtils;
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('shop:shopDealerWithdraw:list')")
|
@PreAuthorize("hasAuthority('shop:shopDealerWithdraw:list')")
|
||||||
@Operation(summary = "分页查询分销商提现明细表")
|
@Operation(summary = "分页查询分销商提现明细表")
|
||||||
@@ -89,6 +92,8 @@ public class ShopDealerWithdrawController extends BaseController {
|
|||||||
return fail("tenantId为空,无法发起提现");
|
return fail("tenantId为空,无法发起提现");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String orderNo = orderNoUtils.generate("WD");
|
||||||
|
shopDealerWithdraw.setOrderNo(orderNo);
|
||||||
shopDealerWithdraw.setTenantId(tenantId);
|
shopDealerWithdraw.setTenantId(tenantId);
|
||||||
shopDealerWithdraw.setUserId(loginUser.getUserId());
|
shopDealerWithdraw.setUserId(loginUser.getUserId());
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,9 @@ public class ShopDealerWithdraw implements Serializable {
|
|||||||
@TableId(value = "id", type = IdType.AUTO)
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
|
@Schema(description = "订单号")
|
||||||
|
private String orderNo;
|
||||||
|
|
||||||
@Schema(description = "分销商用户ID")
|
@Schema(description = "分销商用户ID")
|
||||||
private Integer userId;
|
private Integer userId;
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.gxwebsoft.shop.entity.ShopDealerReferee;
|
import com.gxwebsoft.shop.entity.ShopDealerReferee;
|
||||||
import com.gxwebsoft.shop.param.ShopDealerRefereeParam;
|
import com.gxwebsoft.shop.param.ShopDealerRefereeParam;
|
||||||
|
import com.gxwebsoft.shop.vo.ShopDealerRefereeVO;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -39,6 +40,6 @@ public interface ShopDealerRefereeMapper extends BaseMapper<ShopDealerReferee> {
|
|||||||
* @param userId 用户ID
|
* @param userId 用户ID
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Integer getDealerIdByUserId(@Param("userId") Integer userId);
|
ShopDealerRefereeVO getDealerIdByUserId(@Param("userId") Integer userId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,6 @@
|
|||||||
</if>
|
</if>
|
||||||
<if test="param.keywords != null">
|
<if test="param.keywords != null">
|
||||||
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
|
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
OR a.user_id = #{param.keywords}
|
|
||||||
OR a.order_no = #{param.keywords}
|
OR a.order_no = #{param.keywords}
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
|
|||||||
@@ -57,15 +57,20 @@
|
|||||||
<select id="selectListRel" resultType="com.gxwebsoft.shop.entity.ShopDealerReferee">
|
<select id="selectListRel" resultType="com.gxwebsoft.shop.entity.ShopDealerReferee">
|
||||||
<include refid="selectSql"></include>
|
<include refid="selectSql"></include>
|
||||||
</select>
|
</select>
|
||||||
<select id="getDealerIdByUserId" resultType="java.lang.Integer">
|
<select id="getDealerIdByUserId" resultType="com.gxwebsoft.shop.vo.ShopDealerRefereeVO">
|
||||||
SELECT
|
SELECT
|
||||||
a.dealer_id
|
b.user_id directUserId,
|
||||||
|
b.type directUserType,
|
||||||
|
d.user_id simpleUserId,
|
||||||
|
d.type simpleUserType
|
||||||
FROM
|
FROM
|
||||||
shop_dealer_referee a
|
shop_dealer_referee a
|
||||||
LEFT JOIN shop_dealer_user b ON a.dealer_id = b.user_id
|
LEFT JOIN shop_dealer_user b ON a.dealer_id = b.user_id
|
||||||
|
LEFT JOIN shop_dealer_referee c ON b.user_id = c.user_id
|
||||||
|
LEFT JOIN shop_dealer_user d ON d.user_id = c.dealer_id
|
||||||
WHERE
|
WHERE
|
||||||
b.is_delete = 0
|
b.is_delete = 0
|
||||||
AND b.type = 0
|
and d.is_delete = 0
|
||||||
AND a.user_id = #{userId}
|
AND a.user_id = #{userId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ public class ShopDealerCommissionRollbackServiceImpl implements ShopDealerCommis
|
|||||||
if (refundAmount.compareTo(orderBaseAmount) >= 0) {
|
if (refundAmount.compareTo(orderBaseAmount) >= 0) {
|
||||||
return BigDecimal.ONE;
|
return BigDecimal.ONE;
|
||||||
}
|
}
|
||||||
return refundAmount.divide(orderBaseAmount, 10, RoundingMode.HALF_UP);
|
return refundAmount.divide(orderBaseAmount, 3, RoundingMode.HALF_UP);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void markDealerOrderInvalid(Integer tenantId, String orderNo) {
|
private void markDealerOrderInvalid(Integer tenantId, String orderNo) {
|
||||||
|
|||||||
27
src/main/java/com/gxwebsoft/shop/vo/ShopDealerRefereeVO.java
Normal file
27
src/main/java/com/gxwebsoft/shop/vo/ShopDealerRefereeVO.java
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
package com.gxwebsoft.shop.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author xm
|
||||||
|
* @since 2026-05-13
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Schema(description = "两级推荐人数据")
|
||||||
|
public class ShopDealerRefereeVO {
|
||||||
|
|
||||||
|
@Schema(description = "一级推荐人")
|
||||||
|
private Integer directUserId;
|
||||||
|
|
||||||
|
@Schema(description = "一级推荐人类型 0-分销商 1-门店/服务商 2-集团分红")
|
||||||
|
private Integer directUserType;
|
||||||
|
|
||||||
|
@Schema(description = "二级推荐人")
|
||||||
|
private Integer simpleUserId;
|
||||||
|
|
||||||
|
@Schema(description = "二级推荐人类型 0-分销商 1-门店/服务商 2-集团分红")
|
||||||
|
private Integer simpleUserType;
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user