From 51ba4959cc39def454747c27e5c0de44f685fc2c Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Mon, 22 Aug 2022 13:39:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8C=BA=E5=9F=9F=E5=85=AC?= =?UTF-8?q?=E5=8F=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BsDistributionUserRelController.java | 40 +++++++++++++++++++ .../bweb/controller/HighUserController.java | 30 ++++++++++++++ .../com/cweb/controller/WechatController.java | 1 + .../main/java/com/hai/entity/HighOrder.java | 10 +++++ .../service/BsDistributionUserRelService.java | 11 +++++ .../com/hai/service/HighOrderService.java | 18 +++++++++ .../BsDistributionUserRelServiceImpl.java | 12 ++++++ .../service/impl/HighOrderServiceImpl.java | 27 +++++++++++++ 8 files changed, 149 insertions(+) diff --git a/hai-bweb/src/main/java/com/bweb/controller/BsDistributionUserRelController.java b/hai-bweb/src/main/java/com/bweb/controller/BsDistributionUserRelController.java index ad3af529..1afd1921 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/BsDistributionUserRelController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/BsDistributionUserRelController.java @@ -2,10 +2,13 @@ package com.bweb.controller; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import com.hai.common.security.SessionObject; import com.hai.common.security.UserCenter; import com.hai.common.utils.ResponseMsgUtil; +import com.hai.model.HighUserModel; import com.hai.model.ResponseData; import com.hai.service.BsDistributionUserRelService; +import com.hai.service.HighOrderService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.slf4j.Logger; @@ -18,6 +21,7 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; import java.text.SimpleDateFormat; import java.util.HashMap; import java.util.Map; @@ -32,6 +36,9 @@ public class BsDistributionUserRelController { @Autowired private UserCenter userCenter; + @Resource + private HighOrderService highOrderService; + @Resource private BsDistributionUserRelService bsDistributionUserRelService; @@ -115,4 +122,37 @@ public class BsDistributionUserRelController { return ResponseMsgUtil.exception(e); } } + + @RequestMapping(value = "/agentUserList", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询代理商用户") + public ResponseData agentUserList() { + try { + + return ResponseMsgUtil.success(bsDistributionUserRelService.agentUserList()); + + } catch (Exception e) { + log.error("HighOrderController --> getOrderById() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/orderListByAgentId", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "B端查询代理商订单") + public ResponseData orderListByAgentId(@RequestParam(name = "agentId", required = false) Long agentId, + @RequestParam(name = "pageNum", required = true) Integer pageNum, + @RequestParam(name = "pageSize", required = true) Integer pageSize) { + try { + + Map map = new HashMap<>(); + map.put("agentId" , agentId); + + PageHelper.startPage(pageNum,pageSize); + return ResponseMsgUtil.success(new PageInfo<>(highOrderService.orderListByAgentId(map))); + } catch (Exception e) { + log.error("HighOrderController --> getBackendToken() error!", e); + return ResponseMsgUtil.exception(e); + } + } } diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighUserController.java b/hai-bweb/src/main/java/com/bweb/controller/HighUserController.java index eaac0312..c0600141 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighUserController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighUserController.java @@ -165,4 +165,34 @@ public class HighUserController { } } + + @RequestMapping(value = "/setUpAgent", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "设置代理商") + public ResponseData setUpAgent(@RequestParam(value = "userId" , required = true) Long userId) { + try { + + HighUser highUser = highUserService.findByUserId(userId); + + if (highUser == null) { + log.error("HighUserController --> forbiddenUser() error!"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_USER_ERROR, ""); + } + + if (highUser.getIsAgent() == null || !highUser.getIsAgent()) { + highUser.setIsAgent(true); + } else { + highUser.setIsAgent(false); + } + + highUserService.updateUser(highUser); + + return ResponseMsgUtil.success("设置成功"); + + } catch (Exception e) { + log.error("BsPositionController --> addPosition() error!", e); + return ResponseMsgUtil.exception(e); + } + } + } diff --git a/hai-cweb/src/main/java/com/cweb/controller/WechatController.java b/hai-cweb/src/main/java/com/cweb/controller/WechatController.java index 52d9aef1..5de9c0b8 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/WechatController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/WechatController.java @@ -331,4 +331,5 @@ public class WechatController { return ResponseMsgUtil.exception(e); } } + } diff --git a/hai-service/src/main/java/com/hai/entity/HighOrder.java b/hai-service/src/main/java/com/hai/entity/HighOrder.java index cb14630c..9be617a3 100644 --- a/hai-service/src/main/java/com/hai/entity/HighOrder.java +++ b/hai-service/src/main/java/com/hai/entity/HighOrder.java @@ -250,6 +250,16 @@ public class HighOrder implements Serializable { private String goodsTypeName; + private String agentName; + + public String getAgentName() { + return agentName; + } + + public void setAgentName(String agentName) { + this.agentName = agentName; + } + public String getTime() { return time; } 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 a92d07f3..f5b12cd5 100644 --- a/hai-service/src/main/java/com/hai/service/BsDistributionUserRelService.java +++ b/hai-service/src/main/java/com/hai/service/BsDistributionUserRelService.java @@ -3,6 +3,7 @@ package com.hai.service; import com.alibaba.fastjson.JSONObject; import com.hai.entity.BsDistributionRebate; import com.hai.entity.BsDistributionUserRel; +import com.hai.entity.HighUser; import java.util.List; import java.util.Map; @@ -117,4 +118,14 @@ public interface BsDistributionUserRelService { */ List getDistributionIntegralList(Map map); + /** + * @Author Sum1Dream + * @name agentUserList.java + * @Description // 查询代理商用户 + * @Date 15:21 2022/8/19 + * @Param [] + * @return java.util.List + */ + List agentUserList(); + } diff --git a/hai-service/src/main/java/com/hai/service/HighOrderService.java b/hai-service/src/main/java/com/hai/service/HighOrderService.java index f293466c..69b18dca 100644 --- a/hai-service/src/main/java/com/hai/service/HighOrderService.java +++ b/hai-service/src/main/java/com/hai/service/HighOrderService.java @@ -563,6 +563,24 @@ public interface HighOrderService { */ JSONObject orderSource(Integer goodsType , Long goodsId , String orderNo , Long companyId); + /** + * @Author Sum1Dream + * @name promoteOrderList.java + * @Description // 根据渠道商编码查询订单 + * @Date 16:10 2022/8/19 + * @Param [java.lang.Long] + * @return java.util.List + */ List promoteOrderList(Long identificationCode) throws Exception; + /** + * @Author Sum1Dream + * @name orderListByAgentId.java + * @Description // B端查询代理商订单 + * @Date 16:11 2022/8/19 + * @Param [java.util.Map] + * @return java.util.List + */ + List orderListByAgentId(Map map) throws Exception; } + 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 71cb6827..9e0eaa6a 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 @@ -5,6 +5,7 @@ import com.hai.common.utils.DateUtil; import com.hai.common.utils.TelApiUtil; import com.hai.dao.BsDistributionRebateMapper; import com.hai.dao.BsDistributionUserRelMapper; +import com.hai.dao.HighUserMapper; import com.hai.entity.*; import com.hai.service.*; import org.apache.commons.collections4.MapUtils; @@ -38,6 +39,8 @@ public class BsDistributionUserRelServiceImpl implements BsDistributionUserRelSe @Resource private CommonService commonService; + @Resource + private HighUserMapper highUserMapper; @Override public void insertDistributionRebate(Long userId, Long popularizeUserId , String regionId) { @@ -291,4 +294,13 @@ public class BsDistributionUserRelServiceImpl implements BsDistributionUserRelSe example.setOrderByClause("create_time desc"); return bsDistributionRebateMapper.selectByExample(example); } + + @Override + public List agentUserList() { + + HighUserExample example = new HighUserExample(); + example.createCriteria().andIsAgentEqualTo(true).andStatusEqualTo(1); + + return highUserMapper.selectByExample(example); + } } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java index deb2623d..76ca0520 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java @@ -3072,4 +3072,31 @@ public class HighOrderServiceImpl implements HighOrderService { return list; } + + @Override + public List orderListByAgentId(Map map) throws Exception { + + HighOrderExample example = new HighOrderExample(); + HighOrderExample.Criteria criteria = example.createCriteria(); + + criteria.andOrderStatusEqualTo(3); + + if (MapUtils.getLong(map , "agentId") != null) { + criteria.andIdentificationCodeEqualTo(MapUtils.getLong(map , "agentId")); + } else { + criteria.andIdentificationCodeIsNotNull(); + } + + List list = highOrderMapper.selectByExample(example); + + for (HighOrder order : list) { + HighUser user = highUserService.findByUserId(order.getIdentificationCode()); + order.setTime(DateUtil.date2String(order.getCreateTime() , "MM月dd日 HH:mm")); + List childOrder = getChildOrderByOrder(order.getId()); + order.setGoodsTypeName("购买:" + GoodsType.getNameByType(childOrder.get(0).getGoodsType())); + order.setAgentName(user.getName()); + } + + return list; + } }