|
|
@ -9,8 +9,10 @@ import com.gxwebsoft.common.core.web.BaseController; |
|
|
|
import com.gxwebsoft.sdy.param.SdyDealerOrderImportParam; |
|
|
|
import com.gxwebsoft.shop.entity.ShopDealerApply; |
|
|
|
import com.gxwebsoft.shop.entity.ShopDealerOrder; |
|
|
|
import com.gxwebsoft.shop.entity.ShopDealerReferee; |
|
|
|
import com.gxwebsoft.shop.service.ShopDealerApplyService; |
|
|
|
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.tags.Tag; |
|
|
|
import org.springframework.security.access.prepost.PreAuthorize; |
|
|
@ -36,6 +38,8 @@ public class SdyDealerOrderController extends BaseController { |
|
|
|
private ShopDealerOrderService shopDealerOrderService; |
|
|
|
@Resource |
|
|
|
private ShopDealerApplyService shopDealerApplyService; |
|
|
|
@Resource |
|
|
|
private ShopDealerRefereeService shopDealerRefereeService; |
|
|
|
|
|
|
|
/** |
|
|
|
* excel批量导入售电云分销订单 |
|
|
@ -101,20 +105,39 @@ public class SdyDealerOrderController extends BaseController { |
|
|
|
item.setIsInvalid(1); |
|
|
|
item.setIsSettled(0); // 新导入的数据设为未结算
|
|
|
|
|
|
|
|
// 查询绑定关系
|
|
|
|
ShopDealerApply dealerApply = shopDealerApplyService.getByDealerNameRel(d.getComments()); |
|
|
|
|
|
|
|
// 指定用户ID
|
|
|
|
// TODO 导入指定用户ID
|
|
|
|
if(d.getUserId() != null){ |
|
|
|
item.setUserId(d.getUserId()); |
|
|
|
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.setUserId(dealerApply.getUserId()); |
|
|
|
item.setFirstUserId(dealerApply.getRefereeId()); |
|
|
|
} |
|
|
|
|
|
|
|
System.out.println("准备导入数据: " + item); |
|
|
|