From abcad5870d0fe1b01a857fa372e651c9c42fe96f Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Fri, 19 Aug 2022 08:58:00 +0800 Subject: [PATCH] 1 --- .../BsDistributionUserRelController.java | 118 ++++++++++++++++++ .../dao/BsDistributionRebateMapperExt.java | 1 - .../dao/BsDistributionUserRelMapperExt.java | 37 +++++- .../service/BsDistributionUserRelService.java | 48 +++++++ .../BsDistributionUserRelServiceImpl.java | 50 ++++++++ 5 files changed, 252 insertions(+), 2 deletions(-) create mode 100644 hai-bweb/src/main/java/com/bweb/controller/BsDistributionUserRelController.java diff --git a/hai-bweb/src/main/java/com/bweb/controller/BsDistributionUserRelController.java b/hai-bweb/src/main/java/com/bweb/controller/BsDistributionUserRelController.java new file mode 100644 index 00000000..ad3af529 --- /dev/null +++ b/hai-bweb/src/main/java/com/bweb/controller/BsDistributionUserRelController.java @@ -0,0 +1,118 @@ +package com.bweb.controller; + +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.hai.common.security.UserCenter; +import com.hai.common.utils.ResponseMsgUtil; +import com.hai.model.ResponseData; +import com.hai.service.BsDistributionUserRelService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; + +import javax.annotation.Resource; +import java.text.SimpleDateFormat; +import java.util.HashMap; +import java.util.Map; + +@Controller +@RequestMapping(value = "/bsDistributionUserRel") +@Api(value = "分销人员") +public class BsDistributionUserRelController { + + private static Logger log = LoggerFactory.getLogger(BsIntegralRebateController.class); + + @Autowired + private UserCenter userCenter; + + @Resource + private BsDistributionUserRelService bsDistributionUserRelService; + + @RequestMapping(value = "/getDistributionAgent", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询分销代理商") + public ResponseData getDistributionAgent() { + try { + + return ResponseMsgUtil.success(bsDistributionUserRelService.getDistributionAgent()); + + } catch (Exception e) { + log.error("HighOrderController --> getOrderById() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/getDistributionFirst", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询分销一级") + public ResponseData getDistributionFirst(@RequestParam(name = "agentId", required = false) Long agentId) { + try { + + return ResponseMsgUtil.success(bsDistributionUserRelService.getDistributionFirst(agentId)); + + } catch (Exception e) { + log.error("HighOrderController --> getOrderById() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/getDistributionSecond", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询分销二级") + public ResponseData getDistributionSecond(@RequestParam(name = "agentId", required = false) Long agentId, + @RequestParam(name = "popularizeUserId", required = false) Long popularizeUserId) { + try { + + return ResponseMsgUtil.success(bsDistributionUserRelService.getDistributionSecond(agentId , popularizeUserId)); + + } catch (Exception e) { + log.error("HighOrderController --> getOrderById() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/getDistributionIntegralList", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询分销积分记录") + public ResponseData getDistributionIntegralList(@RequestParam(name = "title", required = false) String title, + @RequestParam(name = "type", required = false) Integer type, + @RequestParam(name = "orderNo", required = false) String orderNo, + @RequestParam(name = "agentId", required = false) Long agentId, + @RequestParam(name = "popularizeUserId", required = false) Long popularizeUserId, + @RequestParam(name = "userName", required = false) String userName, + @RequestParam(name = "createTimeS", required = false) Long createTimeS, + @RequestParam(name = "createTimeE", required = false) Long createTimeE, + @RequestParam(name = "pageNum", required = true) Integer pageNum, + @RequestParam(name = "pageSize", required = true) Integer pageSize + ) { + try { + + Map map = new HashMap<>(); + + map.put("title", title); + map.put("type", type); + map.put("orderNo", orderNo); + map.put("agentId", agentId); + map.put("popularizeUserId", popularizeUserId); + map.put("userName", userName); + + if (createTimeS != null && createTimeE != null) { + map.put("createTimeS", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(createTimeS)); + map.put("createTimeE", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(createTimeE)); + } + + PageHelper.startPage(pageNum, pageSize); + return ResponseMsgUtil.success(new PageInfo<>(bsDistributionUserRelService.getDistributionIntegralList(map))); + } catch (Exception e) { + log.error("HighOrderController --> getOrderById() error!", e); + return ResponseMsgUtil.exception(e); + } + } +} diff --git a/hai-service/src/main/java/com/hai/dao/BsDistributionRebateMapperExt.java b/hai-service/src/main/java/com/hai/dao/BsDistributionRebateMapperExt.java index 7dabc685..7788ded0 100644 --- a/hai-service/src/main/java/com/hai/dao/BsDistributionRebateMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/BsDistributionRebateMapperExt.java @@ -26,5 +26,4 @@ public interface BsDistributionRebateMapperExt { }) BigDecimal toDayIntegralNum(@Param("userId") Long userId); - } diff --git a/hai-service/src/main/java/com/hai/dao/BsDistributionUserRelMapperExt.java b/hai-service/src/main/java/com/hai/dao/BsDistributionUserRelMapperExt.java index 1cc0bed1..f1f527e7 100644 --- a/hai-service/src/main/java/com/hai/dao/BsDistributionUserRelMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/BsDistributionUserRelMapperExt.java @@ -1,7 +1,42 @@ package com.hai.dao; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.util.List; +import java.util.Map; + /** * mapper扩展类 */ public interface BsDistributionUserRelMapperExt { -} \ No newline at end of file + + + @Select({ + "" + }) + List> getDistributionAgent(); + + @Select({ + "" + }) + List> getDistributionFirst(@Param("agentId") Long agentId); + + @Select({ + "" + }) + List> getDistributionSecond(@Param("agentId") Long agentId , @Param("popularizeUserId") Long popularizeUserId); + +} diff --git a/hai-service/src/main/java/com/hai/service/BsDistributionUserRelService.java b/hai-service/src/main/java/com/hai/service/BsDistributionUserRelService.java index 586cfa4f..a92d07f3 100644 --- a/hai-service/src/main/java/com/hai/service/BsDistributionUserRelService.java +++ b/hai-service/src/main/java/com/hai/service/BsDistributionUserRelService.java @@ -67,6 +67,54 @@ public interface BsDistributionUserRelService { JSONObject userDistributionStatistics(Long userId); + /** + * @Author Sum1Dream + * @name getDistributionRebateList.java + * @Description //TODO + * @Date 15:52 2022/8/18 + * @Param [java.util.Map] + * @return java.util.List + */ List getDistributionRebateList(Map map) throws Exception; + /** + * @Author Sum1Dream + * @name getDistributionAgent.java + * @Description // 查询分销代理商 + * @Date 16:11 2022/8/18 + * @Param [] + * @return java.util.List> + */ + List> getDistributionAgent(); + + /** + * @Author Sum1Dream + * @name getDistributionFirst.java + * @Description // 查询一级分销 + * @Date 16:27 2022/8/18 + * @Param [] + * @return java.util.List> + */ + List> getDistributionFirst(Long agentId); + + /** + * @Author Sum1Dream + * @name getDistributionSecond.java + * @Description // 查询二级分销 + * @Date 16:27 2022/8/18 + * @Param [] + * @return java.util.List> + */ + List> getDistributionSecond(Long agentId , Long popularizeUserId); + + /** + * @Author Sum1Dream + * @name getDistributionIntegralList.java + * @Description // 查询分销积分列表 + * @Date 17:10 2022/8/18 + * @Param [java.util.Map] + * @return java.util.List + */ + List getDistributionIntegralList(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 index 479cec00..71cb6827 100644 --- a/hai-service/src/main/java/com/hai/service/impl/BsDistributionUserRelServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/BsDistributionUserRelServiceImpl.java @@ -8,6 +8,7 @@ import com.hai.dao.BsDistributionUserRelMapper; import com.hai.entity.*; import com.hai.service.*; import org.apache.commons.collections4.MapUtils; +import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -241,4 +242,53 @@ public class BsDistributionUserRelServiceImpl implements BsDistributionUserRelSe return list; } + + @Override + public List> getDistributionAgent() { + return bsDistributionUserRelMapper.getDistributionAgent(); + } + + @Override + public List> getDistributionFirst(Long agentId) { + return bsDistributionUserRelMapper.getDistributionFirst(agentId); + } + + @Override + public List> getDistributionSecond(Long agentId, Long popularizeUserId) { + return bsDistributionUserRelMapper.getDistributionSecond(agentId , popularizeUserId); + } + + @Override + public List getDistributionIntegralList(Map map) { + + BsDistributionRebateExample example = new BsDistributionRebateExample(); + BsDistributionRebateExample.Criteria criteria = example.createCriteria(); + + if (MapUtils.getString(map, "title") != null) { + criteria.andTitleLike("%" + MapUtils.getString(map, "title") + "%"); + } + if (MapUtils.getInteger(map, "type") != null) { + criteria.andTypeEqualTo(MapUtils.getInteger(map, "type")); + } + if (MapUtils.getString(map, "orderNo") != null) { + criteria.andOrderNoEqualTo(MapUtils.getString(map, "orderNo")); + } + if (MapUtils.getLong(map, "agentId") != null) { + criteria.andAgentIdEqualTo(MapUtils.getLong(map, "agentId")); + } + if (MapUtils.getLong(map, "popularizeUserId") != null) { + criteria.andPopularizeUserIdEqualTo(MapUtils.getLong(map, "popularizeUserId")); + } + if (MapUtils.getString(map, "userName") != null) { + criteria.andUserNameLike("%" + MapUtils.getString(map, "userName") + "%"); + } + if (StringUtils.isNotBlank(MapUtils.getString(map, "createTimeS")) && StringUtils.isNotBlank(MapUtils.getString(map, "createTimeE"))) { + criteria.andCreateTimeBetween( + DateUtil.format(MapUtils.getString(map, "createTimeS"), "yyyy-MM-dd HH:mm:ss"), + DateUtil.format(MapUtils.getString(map, "createTimeE"), "yyyy-MM-dd HH:mm:ss")); + } + + example.setOrderByClause("create_time desc"); + return bsDistributionRebateMapper.selectByExample(example); + } }