dev-discount
袁野 2 years ago
parent 281cc423e0
commit 80f1ec3403
  1. 12
      hai-bweb/src/main/java/com/bweb/controller/HighDiscountPackageController.java
  2. 47
      hai-service/src/main/java/com/hai/service/BsDistributionUserRelService.java
  3. 73
      hai-service/src/main/java/com/hai/service/impl/BsDistributionUserRelServiceImpl.java
  4. 8
      hai-service/src/main/java/com/hai/service/impl/BsIntegralRebateServiceImpl.java
  5. 2
      hai-service/src/main/java/com/hai/service/impl/HltUnionCardVipServiceImpl.java

@ -164,9 +164,9 @@ public class HighDiscountPackageController {
if (StringUtils.isBlank(highDiscountPackage.getTitle()) if (StringUtils.isBlank(highDiscountPackage.getTitle())
|| highDiscountPackage.getSalesType() == null || highDiscountPackage.getSalesType() == null
|| StringUtils.isBlank(highDiscountPackage.getBannerImg()) // || StringUtils.isBlank(highDiscountPackage.getBannerImg())
|| StringUtils.isBlank(highDiscountPackage.getListImg()) // || StringUtils.isBlank(highDiscountPackage.getListImg())
|| StringUtils.isBlank(highDiscountPackage.getDetailsImg()) // || StringUtils.isBlank(highDiscountPackage.getDetailsImg())
) { ) {
log.error("HighAgentController -> insertCouponPackageInfo() error!","参数错误"); log.error("HighAgentController -> insertCouponPackageInfo() error!","参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
@ -225,9 +225,9 @@ public class HighDiscountPackageController {
if (StringUtils.isBlank(highDiscountPackage.getTitle()) if (StringUtils.isBlank(highDiscountPackage.getTitle())
|| highDiscountPackage.getSalesType() == null || highDiscountPackage.getSalesType() == null
|| highDiscountPackage.getId() == null || highDiscountPackage.getId() == null
|| StringUtils.isBlank(highDiscountPackage.getBannerImg()) // || StringUtils.isBlank(highDiscountPackage.getBannerImg())
|| StringUtils.isBlank(highDiscountPackage.getListImg()) // || StringUtils.isBlank(highDiscountPackage.getListImg())
|| StringUtils.isBlank(highDiscountPackage.getDetailsImg()) // || StringUtils.isBlank(highDiscountPackage.getDetailsImg())
) { ) {
log.error("HighAgentController -> updateCouponPackageInfo() error!","参数错误"); log.error("HighAgentController -> updateCouponPackageInfo() error!","参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");

@ -0,0 +1,47 @@
package com.hai.service;
import com.hai.entity.BsDistributionRebate;
import com.hai.entity.BsDistributionUserRel;
import java.util.List;
import java.util.Map;
/**
* @serviceName BsDistributionUserRelService.java
* @author Sum1Dream
* @version 1.0.0
* @Description // 分销用户关联接口
* @createTime 17:47 2022/8/11
**/
public interface BsDistributionUserRelService {
/**
* @Author Sum1Dream
* @name insertDistributionRebate.java
* @Description // 新增关联关系
* @Date 17:55 2022/8/11
* @Param [java.lang.Long, java.lang.Long]
* @return void
*/
void insertDistributionRebate(Long userId , String userName, Long popularizeUserId);
/**
* @Author Sum1Dream
* @name getDistributionRebateList.java
* @Description // 查询关联列表
* @Date 17:51 2022/8/11
* @Param [java.util.Map<java.lang.String,java.lang.Object>]
* @return java.util.List<com.hai.entity.BsDistributionRebate>
*/
List<BsDistributionUserRel> getDistributionUserRelList(Map<String, Object> map);
/**
* @Author Sum1Dream
* @name findDistributionUserRel.java
* @Description // 查询关联关系详情
* @Date 18:00 2022/8/11
* @Param [java.util.Map<java.lang.String,java.lang.Object>]
* @return com.hai.entity.BsDistributionUserRel
*/
BsDistributionUserRel findDistributionUserRel(Map<String, Object> map);
}

@ -0,0 +1,73 @@
package com.hai.service.impl;
import com.hai.dao.BsDistributionRebateMapper;
import com.hai.dao.BsDistributionUserRelMapper;
import com.hai.entity.BsDistributionRebate;
import com.hai.entity.BsDistributionUserRel;
import com.hai.entity.BsDistributionUserRelExample;
import com.hai.service.BsDistributionUserRelService;
import org.apache.commons.collections4.MapUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service("bsDistributionUserRelService")
public class BsDistributionUserRelServiceImpl implements BsDistributionUserRelService {
@Resource
private BsDistributionUserRelMapper bsDistributionUserRelMapper;
@Override
public void insertDistributionRebate(Long userId, String userName , Long popularizeUserId) {
// 定义分销关联关系
BsDistributionUserRel distributionUserRel = new BsDistributionUserRel();
// 查询推广员信息
Map<String, Object> map = new HashMap<>();
map.put("userId" , popularizeUserId);
BsDistributionUserRel popularizeUser = findDistributionUserRel(map);
distributionUserRel.setUserId(userId);
distributionUserRel.setUserName(userName);
distributionUserRel.setAgentId(popularizeUser.getAgentId());
distributionUserRel.setAgentName(popularizeUser.getAgentName());
distributionUserRel.setPopularizeUserId(popularizeUserId);
distributionUserRel.setPopularizeUserName(popularizeUser.getUserName());
distributionUserRel.setCreateTime(new Date());
distributionUserRel.setUpdateTime(new Date());
distributionUserRel.setStatus(100);
bsDistributionUserRelMapper.insert(distributionUserRel);
}
@Override
public List<BsDistributionUserRel> getDistributionUserRelList(Map<String, Object> map) {
return null;
}
@Override
public BsDistributionUserRel findDistributionUserRel(Map<String, Object> map) {
BsDistributionUserRelExample example = new BsDistributionUserRelExample();
BsDistributionUserRelExample.Criteria criteria = example.createCriteria();
if (MapUtils.getLong(map , "userId") != null) {
criteria.andUserIdEqualTo(MapUtils.getLong(map , "userId"));
}
List<BsDistributionUserRel> list = bsDistributionUserRelMapper.selectByExample(example);
if (list.size() > 0) {
return list.get(0);
}
return null;
}
}

@ -4,7 +4,9 @@ import com.alibaba.fastjson.JSONObject;
import com.hai.dao.BsIntegralRebateMapper; import com.hai.dao.BsIntegralRebateMapper;
import com.hai.entity.BsIntegralRebate; import com.hai.entity.BsIntegralRebate;
import com.hai.entity.BsIntegralRebateExample; import com.hai.entity.BsIntegralRebateExample;
import com.hai.entity.HighOrder;
import com.hai.service.BsIntegralRebateService; import com.hai.service.BsIntegralRebateService;
import com.hai.service.HighOrderService;
import com.hai.service.HighUserService; import com.hai.service.HighUserService;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -24,6 +26,9 @@ public class BsIntegralRebateServiceImpl implements BsIntegralRebateService {
@Resource @Resource
private HighUserService highUserService; private HighUserService highUserService;
@Resource
private HighOrderService highOrderService;
@Override @Override
public BsIntegralRebate findIntegralRebateByMap(Map<String, Object> map) { public BsIntegralRebate findIntegralRebateByMap(Map<String, Object> map) {
@ -101,6 +106,9 @@ public class BsIntegralRebateServiceImpl implements BsIntegralRebateService {
if (bsIntegralRebate != null) { if (bsIntegralRebate != null) {
BigDecimal integralNum = object.getBigDecimal("price").multiply(bsIntegralRebate.getPercentage()).setScale( 0, BigDecimal.ROUND_HALF_UP ); BigDecimal integralNum = object.getBigDecimal("price").multiply(bsIntegralRebate.getPercentage()).setScale( 0, BigDecimal.ROUND_HALF_UP );
HighOrder order = highOrderService.getOrderById(object.getLong("orderId"));
highUserService.goldHandle(object.getLong("userId"), integralNum.intValue(), 1, 4, object.getLong("orderId") , object.getString("remark") + integralNum); highUserService.goldHandle(object.getLong("userId"), integralNum.intValue(), 1, 4, object.getLong("orderId") , object.getString("remark") + integralNum);
} }

@ -121,7 +121,7 @@ public class HltUnionCardVipServiceImpl implements HltUnionCardVipService {
map.put("salesType", 2); map.put("salesType", 2);
map.put("status", 1); map.put("status", 1);
// 查询话费专属优惠券包 // 查询专属优惠券包
List<HighDiscountPackage> highDiscountPackages = highDiscountPackageService.getDiscountPackageList(map); List<HighDiscountPackage> highDiscountPackages = highDiscountPackageService.getDiscountPackageList(map);
if (highDiscountPackages.size() == 0) { if (highDiscountPackages.size() == 0) {

Loading…
Cancel
Save