dev-discount
袁野 2 years ago
parent 984bfab7fb
commit abcad5870d
  1. 118
      hai-bweb/src/main/java/com/bweb/controller/BsDistributionUserRelController.java
  2. 1
      hai-service/src/main/java/com/hai/dao/BsDistributionRebateMapperExt.java
  3. 35
      hai-service/src/main/java/com/hai/dao/BsDistributionUserRelMapperExt.java
  4. 48
      hai-service/src/main/java/com/hai/service/BsDistributionUserRelService.java
  5. 50
      hai-service/src/main/java/com/hai/service/impl/BsDistributionUserRelServiceImpl.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<String , Object> 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);
}
}
}

@ -26,5 +26,4 @@ public interface BsDistributionRebateMapperExt {
}) })
BigDecimal toDayIntegralNum(@Param("userId") Long userId); BigDecimal toDayIntegralNum(@Param("userId") Long userId);
} }

@ -1,7 +1,42 @@
package com.hai.dao; 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扩展类 * mapper扩展类
*/ */
public interface BsDistributionUserRelMapperExt { public interface BsDistributionUserRelMapperExt {
@Select({
"<script> " +
" select agent_id as agentId , agent_name as agentName from bs_distribution_user_rel where status = 100 group by agent_id " +
"</script>"
})
List<Map<String , Object>> getDistributionAgent();
@Select({
"<script> " +
" select user_id as userId , user_name as userName from bs_distribution_user_rel where popularize_user_id is null and status = 100 " +
"<if test='agentId != null'> and agent_id = #{agentId} </if>" +
" group by user_id; " +
"</script>"
})
List<Map<String , Object>> getDistributionFirst(@Param("agentId") Long agentId);
@Select({
"<script> " +
" select user_id as userId , user_name as userName from bs_distribution_user_rel where status = 100 " +
"<if test='agentId != null'> and agent_id = #{agentId} </if>" +
"<if test='popularizeUserId != null'> and popularize_user_id = #{popularizeUserId} </if>" +
"<if test='popularizeUserId == null'> and popularize_user_id is not null </if>" +
" group by user_id; " +
"</script>"
})
List<Map<String , Object>> getDistributionSecond(@Param("agentId") Long agentId , @Param("popularizeUserId") Long popularizeUserId);
} }

@ -67,6 +67,54 @@ public interface BsDistributionUserRelService {
JSONObject userDistributionStatistics(Long userId); JSONObject userDistributionStatistics(Long userId);
/**
* @Author Sum1Dream
* @name getDistributionRebateList.java
* @Description //TODO
* @Date 15:52 2022/8/18
* @Param [java.util.Map<java.lang.String,java.lang.Object>]
* @return java.util.List<com.hai.entity.BsDistributionRebate>
*/
List<BsDistributionRebate> getDistributionRebateList(Map<String, Object> map) throws Exception; List<BsDistributionRebate> getDistributionRebateList(Map<String, Object> map) throws Exception;
/**
* @Author Sum1Dream
* @name getDistributionAgent.java
* @Description // 查询分销代理商
* @Date 16:11 2022/8/18
* @Param []
* @return java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
*/
List<Map<String , Object>> getDistributionAgent();
/**
* @Author Sum1Dream
* @name getDistributionFirst.java
* @Description // 查询一级分销
* @Date 16:27 2022/8/18
* @Param []
* @return java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
*/
List<Map<String , Object>> getDistributionFirst(Long agentId);
/**
* @Author Sum1Dream
* @name getDistributionSecond.java
* @Description // 查询二级分销
* @Date 16:27 2022/8/18
* @Param []
* @return java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
*/
List<Map<String , Object>> getDistributionSecond(Long agentId , Long popularizeUserId);
/**
* @Author Sum1Dream
* @name getDistributionIntegralList.java
* @Description // 查询分销积分列表
* @Date 17:10 2022/8/18
* @Param [java.util.Map<java.lang.String,java.lang.Object>]
* @return java.util.List<com.hai.entity.BsDistributionRebate>
*/
List<BsDistributionRebate> getDistributionIntegralList(Map<String , Object> map);
} }

@ -8,6 +8,7 @@ import com.hai.dao.BsDistributionUserRelMapper;
import com.hai.entity.*; import com.hai.entity.*;
import com.hai.service.*; import com.hai.service.*;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -241,4 +242,53 @@ public class BsDistributionUserRelServiceImpl implements BsDistributionUserRelSe
return list; return list;
} }
@Override
public List<Map<String, Object>> getDistributionAgent() {
return bsDistributionUserRelMapper.getDistributionAgent();
}
@Override
public List<Map<String, Object>> getDistributionFirst(Long agentId) {
return bsDistributionUserRelMapper.getDistributionFirst(agentId);
}
@Override
public List<Map<String, Object>> getDistributionSecond(Long agentId, Long popularizeUserId) {
return bsDistributionUserRelMapper.getDistributionSecond(agentId , popularizeUserId);
}
@Override
public List<BsDistributionRebate> getDistributionIntegralList(Map<String, Object> 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);
}
} }

Loading…
Cancel
Save