分销代码

dev-discount
袁野 2 years ago
parent 51ba4959cc
commit e66833057c
  1. 2
      hai-cweb/src/main/resources/dev/config.properties
  2. 2
      hai-cweb/src/main/resources/prod-9401/config.properties
  3. 2
      hai-cweb/src/main/resources/prod/config.properties
  4. 8
      hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java
  5. 97
      hai-service/src/main/java/com/hai/service/impl/BsDistributionUserRelServiceImpl.java
  6. 11
      hai-service/src/main/java/com/hai/service/impl/BsIntegralRebateServiceImpl.java
  7. 6
      hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java

@ -24,4 +24,4 @@ fileUrl=/home/project/hsg/filesystem
cmsPath=/home/project/hsg/filesystem/cmsPath
couponCodePath=/home/project/hsg/filesystem/couponCode
qrCodeUrl=https://hsgcs.dctpay.com/hsgH5?accountId=000009&key=&code=
qrCodeUrl=https://hsgcs.dctpay.com/hsgH5?accountId=0000010&key=&code=

@ -23,4 +23,4 @@ cmsPath=/home/project/hsg/filesystem/cmsPath
couponCodePath=/home/project/hsg/filesystem/couponCode
qrCodeUrl=https://hsg.dctpay.com/hsgH5?accountId=000009&key=&code=
qrCodeUrl=https://hsg.dctpay.com/hsgH5?accountId=0000010&key=&code=

@ -25,4 +25,4 @@ cmsPath=/home/project/hsg/filesystem/cmsPath
couponCodePath=/home/project/hsg/filesystem/couponCode
qrCodeUrl=https://hsg.dctpay.com/hsgH5?accountId=000009&key=&code=
qrCodeUrl=https://hsg.dctpay.com/hsgH5?accountId=0000010&key=&code=

@ -431,6 +431,14 @@ public class HighOrderSchedule {
}
}
}
/**
* @Author Sum1Dream
* @name integralRebateOrder.java
* @Description // 执行返利操作
* @Date 15:13 2022/8/22
* @Param []
* @return void
*/
@Scheduled(cron="0 0/1 * * * ?") //每1分钟执行一次
public void integralRebateOrder() {
List<HighOrder> order = highOrderService.integralRebateOrder();

@ -56,58 +56,59 @@ public class BsDistributionUserRelServiceImpl implements BsDistributionUserRelSe
map.put("userId" , popularizeUserId);
BsDistributionUserRel popularizeUser = findDistributionUserRel(map);
if (pUser.getIsAgent() != null) {
distributionUserRel.setAgentId(pUser.getId());
distributionUserRel.setAgentName(pUser.getName());
} else {
if (popularizeUser != null) {
distributionUserRel.setAgentId(popularizeUser.getAgentId());
distributionUserRel.setAgentName(popularizeUser.getAgentName());
if (pUser != null) {
if (pUser.getIsAgent() != null) {
distributionUserRel.setAgentId(pUser.getId());
distributionUserRel.setAgentName(pUser.getName());
} else {
if (popularizeUser != null) {
distributionUserRel.setAgentId(popularizeUser.getAgentId());
distributionUserRel.setAgentName(popularizeUser.getAgentName());
}
distributionUserRel.setPopularizeUserId(popularizeUserId);
distributionUserRel.setPopularizeUserName(pUser.getName());
}
distributionUserRel.setPopularizeUserId(popularizeUserId);
distributionUserRel.setPopularizeUserName(pUser.getName());
}
distributionUserRel.setUserId(userId);
distributionUserRel.setUserName(user.getName());
distributionUserRel.setPhone(TelApiUtil.phoneDesensitization(user.getPhone()));
distributionUserRel.setCreateTime(new Date());
distributionUserRel.setUpdateTime(new Date());
distributionUserRel.setStatus(100);
bsDistributionUserRelMapper.insert(distributionUserRel);
new Thread(() -> {
try {
SecRegion region = commonService.getParentByRegion(Long.valueOf(regionId));
BsCompany bsCompany = bsCompanyService.selectCompanyByRegion(region.getRegionId().toString());
// 查询注册有礼优惠券包
HighDiscountPackage discountPackage = highDiscountPackageService.getCallExclusive(3 , bsCompany.getId().intValue());
Map<String, Object> freeMap = new HashMap<>();
freeMap.put("discountPackageId", discountPackage.getId());
freeMap.put("userId", userId);
freeMap.put("userPhone", user.getPhone());
highDiscountPackageService.freeUserDiscountPackage(freeMap);
if (pUser.getIsAgent() == null) {
// 查询推广有礼优惠券包
HighDiscountPackage promoteDiscountPackage = highDiscountPackageService.getCallExclusive(4 , bsCompany.getId().intValue());
Map<String, Object> freeMap1 = new HashMap<>();
freeMap1.put("discountPackageId", promoteDiscountPackage.getId());
freeMap1.put("userId", pUser.getId());
freeMap1.put("userPhone", pUser.getPhone());
highDiscountPackageService.freeUserDiscountPackage(freeMap1);
}
distributionUserRel.setUserId(userId);
distributionUserRel.setUserName(user.getName());
distributionUserRel.setPhone(TelApiUtil.phoneDesensitization(user.getPhone()));
distributionUserRel.setCreateTime(new Date());
distributionUserRel.setUpdateTime(new Date());
distributionUserRel.setStatus(100);
bsDistributionUserRelMapper.insert(distributionUserRel);
new Thread(() -> {
try {
SecRegion region = commonService.getParentByRegion(Long.valueOf(regionId));
BsCompany bsCompany = bsCompanyService.selectCompanyByRegion(region.getRegionId().toString());
// 查询注册有礼优惠券包
HighDiscountPackage discountPackage = highDiscountPackageService.getCallExclusive(3 , bsCompany.getId().intValue());
Map<String, Object> freeMap = new HashMap<>();
freeMap.put("discountPackageId", discountPackage.getId());
freeMap.put("userId", userId);
freeMap.put("userPhone", user.getPhone());
highDiscountPackageService.freeUserDiscountPackage(freeMap);
if (pUser.getIsAgent() == null) {
// 查询推广有礼优惠券包
HighDiscountPackage promoteDiscountPackage = highDiscountPackageService.getCallExclusive(4 , bsCompany.getId().intValue());
Map<String, Object> freeMap1 = new HashMap<>();
freeMap1.put("discountPackageId", promoteDiscountPackage.getId());
freeMap1.put("userId", pUser.getId());
freeMap1.put("userPhone", pUser.getPhone());
highDiscountPackageService.freeUserDiscountPackage(freeMap1);
}
} catch (Exception e) {
e.printStackTrace();
}
} catch (Exception e) {
e.printStackTrace();
}
}).start();
}).start();
}
}

@ -118,16 +118,8 @@ public class BsIntegralRebateServiceImpl implements BsIntegralRebateService {
BigDecimal integralNumFirst = object.getBigDecimal("price").multiply(bsIntegralRebate.getFirstDistribution()).setScale( 0, BigDecimal.ROUND_HALF_UP );
BigDecimal integralNumSecond = object.getBigDecimal("price").multiply(bsIntegralRebate.getSecondDistribution()).setScale( 0, BigDecimal.ROUND_HALF_UP );
/*
HighOrder order = highOrderService.getOrderById(object.getLong("orderId"));
*/
order.setWhetherRebate(true);
highOrderService.updateOrder(order);
highUserService.goldHandle(object.getLong("userId"), integralNum.intValue(), 1, 4, object.getLong("orderId") , object.getString("remark") + integralNum);
JSONObject jsonObject = new JSONObject();
jsonObject.put("integralNumFirst" , integralNumFirst);
@ -138,6 +130,9 @@ public class BsIntegralRebateServiceImpl implements BsIntegralRebateService {
jsonObject.put("logoImg" , object.getString("logoImg"));
bsDistributionUserRelService.distributionRebate(jsonObject);
highOrderService.updateOrder(order);
highUserService.goldHandle(object.getLong("userId"), integralNum.intValue(), 1, 4, object.getLong("orderId") , object.getString("remark") + integralNum);
}

@ -3013,10 +3013,10 @@ public class HighOrderServiceImpl implements HighOrderService {
HighCoupon coupon = highCouponService.getCouponById(goodsId);
object.put("type" , 1);
object.put("productId", coupon.getCouponSource());
object.put("productId", 1);
object.put("companyId", coupon.getCompanyId());
object.put("remark" , "卡券订单:"+ coupon + "-" + orderNo + "积分返利:");
object.put("name" , "购买卡券产品:"+ coupon);
object.put("remark" , "卡券订单:"+ coupon.getCouponName() + "-" + orderNo + "积分返利:");
object.put("name" , "购买卡券产品:"+ coupon.getCouponName());
}
if (goodsType == 3) {

Loading…
Cancel
Save