Commit 22b767cf authored by suntao's avatar suntao

channel List 查询

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