|
|
|
@ -1,7 +1,9 @@ |
|
|
|
|
package com.hai.service.impl; |
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.hai.common.utils.BaiduUtils; |
|
|
|
|
import com.hai.common.utils.DateUtil; |
|
|
|
|
import com.hai.common.utils.RequestUtils; |
|
|
|
|
import com.hai.common.utils.TelApiUtil; |
|
|
|
|
import com.hai.dao.BsDistributionRebateMapper; |
|
|
|
|
import com.hai.dao.BsDistributionUserRelMapper; |
|
|
|
@ -43,7 +45,7 @@ public class BsDistributionUserRelServiceImpl implements BsDistributionUserRelSe |
|
|
|
|
private HighUserMapper highUserMapper; |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void insertDistributionRebate(Long userId, Long popularizeUserId , String regionId) { |
|
|
|
|
public void insertDistributionRebate(Long userId, Long popularizeUserId , String requestIp) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HighUser user = highUserService.findByUserId(userId); |
|
|
|
@ -85,12 +87,15 @@ public class BsDistributionUserRelServiceImpl implements BsDistributionUserRelSe |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
if (regionId != null) { |
|
|
|
|
SecRegion region = commonService.getParentByRegion(Long.valueOf(regionId)); |
|
|
|
|
BsCompany bsCompany = bsCompanyService.selectCompanyByRegion(region.getRegionId().toString()); |
|
|
|
|
JSONObject object = BaiduUtils.ipLocation(requestIp); |
|
|
|
|
|
|
|
|
|
if (object.getInteger("status") == 0) { |
|
|
|
|
String province = object.getJSONObject("content").getJSONObject("address_detail").getString("province"); |
|
|
|
|
ApiCity apiCity = commonService.findCityByProvinceName(province); |
|
|
|
|
BsCompany company = bsCompanyService.selectCompanyByRegion(apiCity.getProvinceCode()); |
|
|
|
|
|
|
|
|
|
// 查询注册有礼优惠券包
|
|
|
|
|
HighDiscountPackage discountPackage = highDiscountPackageService.getCallExclusive(3 , bsCompany.getId().intValue()); |
|
|
|
|
HighDiscountPackage discountPackage = highDiscountPackageService.getCallExclusive(3 , company.getId().intValue()); |
|
|
|
|
Map<String, Object> freeMap = new HashMap<>(); |
|
|
|
|
freeMap.put("discountPackageId", discountPackage.getId()); |
|
|
|
|
freeMap.put("userId", userId); |
|
|
|
@ -99,7 +104,7 @@ public class BsDistributionUserRelServiceImpl implements BsDistributionUserRelSe |
|
|
|
|
|
|
|
|
|
if (pUser != null && pUser.getIsAgent() == null) { |
|
|
|
|
// 查询推广有礼优惠券包
|
|
|
|
|
HighDiscountPackage promoteDiscountPackage = highDiscountPackageService.getCallExclusive(4 , bsCompany.getId().intValue()); |
|
|
|
|
HighDiscountPackage promoteDiscountPackage = highDiscountPackageService.getCallExclusive(4 , company.getId().intValue()); |
|
|
|
|
Map<String, Object> freeMap1 = new HashMap<>(); |
|
|
|
|
freeMap1.put("discountPackageId", promoteDiscountPackage.getId()); |
|
|
|
|
freeMap1.put("userId", pUser.getId()); |
|
|
|
@ -108,6 +113,7 @@ public class BsDistributionUserRelServiceImpl implements BsDistributionUserRelSe |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
|