dev-discount
parent
984bfab7fb
commit
abcad5870d
@ -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); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -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); |
||||||
|
|
||||||
} |
} |
Loading…
Reference in new issue