feat(order): 增加推荐关系查询逻辑- 在控制器中注入 ShopDealerRefereeService 依赖
- 导入订单时根据用户 ID 查询多级推荐关系- 设置一、二、三级推荐人 ID 和昵称 - 补充推荐关系查询接口及其实现方法 -优化已签约客户的数据处理流程
This commit is contained in:
@@ -9,8 +9,10 @@ import com.gxwebsoft.common.core.web.BaseController;
|
|||||||
import com.gxwebsoft.sdy.param.SdyDealerOrderImportParam;
|
import com.gxwebsoft.sdy.param.SdyDealerOrderImportParam;
|
||||||
import com.gxwebsoft.shop.entity.ShopDealerApply;
|
import com.gxwebsoft.shop.entity.ShopDealerApply;
|
||||||
import com.gxwebsoft.shop.entity.ShopDealerOrder;
|
import com.gxwebsoft.shop.entity.ShopDealerOrder;
|
||||||
|
import com.gxwebsoft.shop.entity.ShopDealerReferee;
|
||||||
import com.gxwebsoft.shop.service.ShopDealerApplyService;
|
import com.gxwebsoft.shop.service.ShopDealerApplyService;
|
||||||
import com.gxwebsoft.shop.service.ShopDealerOrderService;
|
import com.gxwebsoft.shop.service.ShopDealerOrderService;
|
||||||
|
import com.gxwebsoft.shop.service.ShopDealerRefereeService;
|
||||||
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.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
@@ -36,6 +38,8 @@ public class SdyDealerOrderController extends BaseController {
|
|||||||
private ShopDealerOrderService shopDealerOrderService;
|
private ShopDealerOrderService shopDealerOrderService;
|
||||||
@Resource
|
@Resource
|
||||||
private ShopDealerApplyService shopDealerApplyService;
|
private ShopDealerApplyService shopDealerApplyService;
|
||||||
|
@Resource
|
||||||
|
private ShopDealerRefereeService shopDealerRefereeService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* excel批量导入售电云分销订单
|
* excel批量导入售电云分销订单
|
||||||
@@ -101,20 +105,39 @@ public class SdyDealerOrderController extends BaseController {
|
|||||||
item.setIsInvalid(1);
|
item.setIsInvalid(1);
|
||||||
item.setIsSettled(0); // 新导入的数据设为未结算
|
item.setIsSettled(0); // 新导入的数据设为未结算
|
||||||
|
|
||||||
// 查询绑定关系
|
// TODO 导入指定用户ID
|
||||||
ShopDealerApply dealerApply = shopDealerApplyService.getByDealerNameRel(d.getComments());
|
|
||||||
|
|
||||||
// 指定用户ID
|
|
||||||
if(d.getUserId() != null){
|
if(d.getUserId() != null){
|
||||||
item.setUserId(d.getUserId());
|
item.setUserId(d.getUserId());
|
||||||
item.setIsInvalid(1);
|
item.setIsInvalid(1);
|
||||||
|
|
||||||
|
}else {
|
||||||
|
// TODO 通过报备客户信息查询绑定关系
|
||||||
|
ShopDealerApply dealerApply = shopDealerApplyService.getByDealerNameRel(d.getComments());
|
||||||
|
|
||||||
|
// 已签约客户
|
||||||
|
if(dealerApply != null){
|
||||||
|
item.setIsInvalid(0);
|
||||||
|
item.setUserId(dealerApply.getUserId());
|
||||||
|
item.setFirstUserId(dealerApply.getRefereeId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 已签约客户
|
// 查询推荐关系
|
||||||
if(dealerApply != null){
|
if(ObjectUtil.isNotEmpty(item.getUserId())){
|
||||||
|
ShopDealerReferee referee = shopDealerRefereeService.getByUserIdRel(item.getUserId());
|
||||||
|
item.setFirstUserId(referee.getDealerId());
|
||||||
|
item.setFirstNickname(referee.getDealerName());
|
||||||
|
ShopDealerReferee referee2 = shopDealerRefereeService.getByUserIdRel(referee.getDealerId());
|
||||||
|
if(ObjectUtil.isNotEmpty(referee2)){
|
||||||
|
item.setSecondUserId(referee2.getDealerId());
|
||||||
|
item.setSecondNickname(referee2.getDealerName());
|
||||||
|
ShopDealerReferee referee3 = shopDealerRefereeService.getByUserIdRel(referee2.getDealerId());
|
||||||
|
if(ObjectUtil.isNotEmpty(referee3)){
|
||||||
|
item.setThirdUserId(referee3.getDealerId());
|
||||||
|
item.setThirdNickname(referee3.getDealerName());
|
||||||
|
}
|
||||||
|
}
|
||||||
item.setIsInvalid(0);
|
item.setIsInvalid(0);
|
||||||
item.setUserId(dealerApply.getUserId());
|
|
||||||
item.setFirstUserId(dealerApply.getRefereeId());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("准备导入数据: " + item);
|
System.out.println("准备导入数据: " + item);
|
||||||
|
|||||||
@@ -39,4 +39,5 @@ public interface ShopDealerRefereeService extends IService<ShopDealerReferee> {
|
|||||||
*/
|
*/
|
||||||
ShopDealerReferee getByIdRel(Integer id);
|
ShopDealerReferee getByIdRel(Integer id);
|
||||||
|
|
||||||
|
ShopDealerReferee getByUserIdRel(Integer userId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,4 +44,11 @@ public class ShopDealerRefereeServiceImpl extends ServiceImpl<ShopDealerRefereeM
|
|||||||
return param.getOne(baseMapper.selectListRel(param));
|
return param.getOne(baseMapper.selectListRel(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ShopDealerReferee getByUserIdRel(Integer userId) {
|
||||||
|
ShopDealerRefereeParam param = new ShopDealerRefereeParam();
|
||||||
|
param.setUserId(userId);
|
||||||
|
return param.getOne(baseMapper.selectListRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user