From 80f1ec3403094e94034e5a2c5932c8e234e19de9 Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Fri, 12 Aug 2022 11:44:53 +0800 Subject: [PATCH] 1 --- .../HighDiscountPackageController.java | 12 +-- .../service/BsDistributionUserRelService.java | 47 ++++++++++++ .../BsDistributionUserRelServiceImpl.java | 73 +++++++++++++++++++ .../impl/BsIntegralRebateServiceImpl.java | 8 ++ .../impl/HltUnionCardVipServiceImpl.java | 2 +- .../v1/controller/GzSinopecController.java | 2 +- 6 files changed, 136 insertions(+), 8 deletions(-) create mode 100644 hai-service/src/main/java/com/hai/service/BsDistributionUserRelService.java create mode 100644 hai-service/src/main/java/com/hai/service/impl/BsDistributionUserRelServiceImpl.java diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighDiscountPackageController.java b/hai-bweb/src/main/java/com/bweb/controller/HighDiscountPackageController.java index 2fbd7056..ded4edef 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighDiscountPackageController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighDiscountPackageController.java @@ -164,9 +164,9 @@ public class HighDiscountPackageController { if (StringUtils.isBlank(highDiscountPackage.getTitle()) || highDiscountPackage.getSalesType() == null - || StringUtils.isBlank(highDiscountPackage.getBannerImg()) - || StringUtils.isBlank(highDiscountPackage.getListImg()) - || StringUtils.isBlank(highDiscountPackage.getDetailsImg()) +// || StringUtils.isBlank(highDiscountPackage.getBannerImg()) +// || StringUtils.isBlank(highDiscountPackage.getListImg()) +// || StringUtils.isBlank(highDiscountPackage.getDetailsImg()) ) { log.error("HighAgentController -> insertCouponPackageInfo() error!","参数错误"); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); @@ -225,9 +225,9 @@ public class HighDiscountPackageController { if (StringUtils.isBlank(highDiscountPackage.getTitle()) || highDiscountPackage.getSalesType() == null || highDiscountPackage.getId() == null - || StringUtils.isBlank(highDiscountPackage.getBannerImg()) - || StringUtils.isBlank(highDiscountPackage.getListImg()) - || StringUtils.isBlank(highDiscountPackage.getDetailsImg()) +// || StringUtils.isBlank(highDiscountPackage.getBannerImg()) +// || StringUtils.isBlank(highDiscountPackage.getListImg()) +// || StringUtils.isBlank(highDiscountPackage.getDetailsImg()) ) { log.error("HighAgentController -> updateCouponPackageInfo() error!","参数错误"); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); diff --git a/hai-service/src/main/java/com/hai/service/BsDistributionUserRelService.java b/hai-service/src/main/java/com/hai/service/BsDistributionUserRelService.java new file mode 100644 index 00000000..bae156b7 --- /dev/null +++ b/hai-service/src/main/java/com/hai/service/BsDistributionUserRelService.java @@ -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] + * @return java.util.List + */ + List getDistributionUserRelList(Map map); + + /** + * @Author Sum1Dream + * @name findDistributionUserRel.java + * @Description // 查询关联关系详情 + * @Date 18:00 2022/8/11 + * @Param [java.util.Map] + * @return com.hai.entity.BsDistributionUserRel + */ + BsDistributionUserRel findDistributionUserRel(Map map); +} diff --git a/hai-service/src/main/java/com/hai/service/impl/BsDistributionUserRelServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/BsDistributionUserRelServiceImpl.java new file mode 100644 index 00000000..bccc9d63 --- /dev/null +++ b/hai-service/src/main/java/com/hai/service/impl/BsDistributionUserRelServiceImpl.java @@ -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 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 getDistributionUserRelList(Map map) { + return null; + } + + @Override + public BsDistributionUserRel findDistributionUserRel(Map map) { + + BsDistributionUserRelExample example = new BsDistributionUserRelExample(); + BsDistributionUserRelExample.Criteria criteria = example.createCriteria(); + + if (MapUtils.getLong(map , "userId") != null) { + criteria.andUserIdEqualTo(MapUtils.getLong(map , "userId")); + } + + List list = bsDistributionUserRelMapper.selectByExample(example); + + if (list.size() > 0) { + return list.get(0); + } + + return null; + } +} diff --git a/hai-service/src/main/java/com/hai/service/impl/BsIntegralRebateServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/BsIntegralRebateServiceImpl.java index f78abcc9..8a9a92a2 100644 --- a/hai-service/src/main/java/com/hai/service/impl/BsIntegralRebateServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/BsIntegralRebateServiceImpl.java @@ -4,7 +4,9 @@ import com.alibaba.fastjson.JSONObject; import com.hai.dao.BsIntegralRebateMapper; import com.hai.entity.BsIntegralRebate; import com.hai.entity.BsIntegralRebateExample; +import com.hai.entity.HighOrder; import com.hai.service.BsIntegralRebateService; +import com.hai.service.HighOrderService; import com.hai.service.HighUserService; import org.apache.commons.collections4.MapUtils; import org.springframework.stereotype.Service; @@ -24,6 +26,9 @@ public class BsIntegralRebateServiceImpl implements BsIntegralRebateService { @Resource private HighUserService highUserService; + @Resource + private HighOrderService highOrderService; + @Override public BsIntegralRebate findIntegralRebateByMap(Map map) { @@ -101,6 +106,9 @@ public class BsIntegralRebateServiceImpl implements BsIntegralRebateService { if (bsIntegralRebate != null) { 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); } diff --git a/hai-service/src/main/java/com/hai/service/impl/HltUnionCardVipServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HltUnionCardVipServiceImpl.java index 1a9facf7..31d307ef 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HltUnionCardVipServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HltUnionCardVipServiceImpl.java @@ -121,7 +121,7 @@ public class HltUnionCardVipServiceImpl implements HltUnionCardVipService { map.put("salesType", 2); map.put("status", 1); - // 查询话费专属优惠券包 + // 查询专属优惠券包 List highDiscountPackages = highDiscountPackageService.getDiscountPackageList(map); if (highDiscountPackages.size() == 0) { diff --git a/v1/src/main/java/com/v1/controller/GzSinopecController.java b/v1/src/main/java/com/v1/controller/GzSinopecController.java index 7ba77376..d501f428 100644 --- a/v1/src/main/java/com/v1/controller/GzSinopecController.java +++ b/v1/src/main/java/com/v1/controller/GzSinopecController.java @@ -36,7 +36,7 @@ import java.util.Map; @Controller @RequestMapping(value = "/gzSinopec") @Api(value = "贵州中石化") -public class GzSinopecController { +public class GzSinopecController { private static Logger log = LoggerFactory.getLogger(GzSinopecController.class);