Commit 22b767cf authored by suntao's avatar suntao

channel List 查询

parent 6eb6b88b
package cn.quantgroup.cashloanflowboss.api.channel.controller;
import cn.quantgroup.cashloanflowboss.api.channel.model.ChannelListModel;
import cn.quantgroup.cashloanflowboss.api.channel.util.ChannelConfUtil;
import cn.quantgroup.cashloanflowboss.core.annotation.RoleDataLoad;
import cn.quantgroup.cashloanflowboss.spi.clf.entity.ChannelConfiguration;
import cn.quantgroup.cashloanflowboss.core.annotation.ChannelIdInit;
import cn.quantgroup.cashloanflowboss.api.channel.service.ChannelConfService;
import cn.quantgroup.cashloanflowboss.api.user.model.Pagination;
import cn.quantgroup.cashloanflowboss.core.base.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
/**
* Created with suntao on 2019/8/2
* @author suntao
......@@ -26,10 +19,17 @@ public class ChannelConfController {
private ChannelConfService channelConfService;
@RoleDataLoad
/**
* 查询渠道列表
* @param channelId 在接受参数时,必须放到第一个参数位置
* @param pageNumber
* @param pageSize
* @return
*/
@ChannelIdInit
@PostMapping("/info")
public Page<ChannelListModel> channelInfo(Long channelId, Integer pageNumber, Integer pageSize) {
return channelConfService.getChannelInfo(pageNumber, pageSize, channelId);
public Result channelInfo(@RequestParam(name = "channelId", required = false) Long channelId, Integer pageNumber, Integer pageSize) {
return Result.buildSuccess(channelConfService.getChannelInfo(pageNumber, pageSize, channelId));
}
......
......@@ -59,6 +59,7 @@ public class ChannelConfService {
channelListModel.setChannelId(it.getRegisteredFrom());
channelListModel.setChannelName(it.getChannelName());
channelListModel.setChannelCode(it.getChannelCode());
// TODO
channelListModel.setBizType(1);
channelListModel.setCreatedAt(it.getCreatedAt());
return channelListModel;
......
......@@ -14,5 +14,5 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
*/
@Target({METHOD})
@Retention(RUNTIME)
public @interface RoleDataLoad {
public @interface ChannelIdInit {
}
package cn.quantgroup.cashloanflowboss.core.aspect;
import cn.quantgroup.cashloanflowboss.api.channel.model.ChannelListModel;
import cn.quantgroup.cashloanflowboss.api.user.model.UserSessionInfo;
import cn.quantgroup.cashloanflowboss.api.user.service.UserSessionService;
import cn.quantgroup.cashloanflowboss.core.annotation.RoleDataLoad;
import cn.quantgroup.cashloanflowboss.core.annotation.ChannelIdInit;
import cn.quantgroup.cashloanflowboss.core.base.BossPageImpl;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.exception.ExceptionUtils;
......@@ -11,19 +10,14 @@ import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.CodeSignature;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.core.convert.converter.Converter;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Component;
import java.lang.reflect.Method;
import java.util.Iterator;
import java.util.List;
/**
* function:
......@@ -48,11 +42,16 @@ public class RoleDataLoadAspect {
Object[] args = pjp.getArgs();
MethodSignature methodSignature = (MethodSignature) pjp.getSignature();
Method method = methodSignature.getMethod();
RoleDataLoad annotation = method.getAnnotation(RoleDataLoad.class);
ChannelIdInit annotation = method.getAnnotation(ChannelIdInit.class);
UserSessionInfo userSessionInfo = userSessionService.findUserSessionInfo();
if (annotation != null && "channel_role".equals(userSessionInfo.getRoleInfo().getRoleName())) {
args[0] = userSessionInfo.getChannelId();
String[] paramNames = ((CodeSignature)pjp.getSignature()).getParameterNames();
for (int i = 0; i < paramNames.length; i++) {
if ("channelId".equals(paramNames[i])) {
args[i] = userSessionInfo.getChannelId();
}
}
}
try {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment