Commit b3b9efe6 authored by suntao's avatar suntao

通过切面注入channelId ,确点channelId 必须是第一个参数

parent 3553c113
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.api.channel.model.ChannelListModel;
import cn.quantgroup.cashloanflowboss.api.channel.util.ChannelConfUtil;
import cn.quantgroup.cashloanflowboss.core.annotation.RoleDataLoad; import cn.quantgroup.cashloanflowboss.core.annotation.RoleDataLoad;
import cn.quantgroup.cashloanflowboss.spi.clf.entity.ChannelConfiguration; import cn.quantgroup.cashloanflowboss.spi.clf.entity.ChannelConfiguration;
import cn.quantgroup.cashloanflowboss.api.channel.service.ChannelConfService; import cn.quantgroup.cashloanflowboss.api.channel.service.ChannelConfService;
...@@ -27,14 +28,14 @@ public class ChannelConfController { ...@@ -27,14 +28,14 @@ public class ChannelConfController {
@RoleDataLoad @RoleDataLoad
@PostMapping("/info") @PostMapping("/info")
public Page<ChannelListModel> channelInfo(Integer channelId, Integer pageNumber, Integer pageSize) { public Page<ChannelListModel> channelInfo(Long channelId, Integer pageNumber, Integer pageSize) {
return channelConfService.getChannelInfo(pageNumber, pageSize, channelId); return channelConfService.getChannelInfo(pageNumber, pageSize, channelId);
} }
@GetMapping("/cfg/info") @GetMapping("/cfg/info")
public Result channelConfInfo(Integer channelId) { public Result channelConfInfo(Long channelId) {
return channelConfService.getChannelConf(channelId); return Result.buildSuccess(channelConfService.getChannelConf(channelId), "success");
} }
......
...@@ -18,7 +18,7 @@ public class ChannelConf extends Primary { ...@@ -18,7 +18,7 @@ public class ChannelConf extends Primary {
* 渠道id * 渠道id
*/ */
@Column(name = "channel_id") @Column(name = "channel_id")
private Integer channelId; private Long channelId;
/** /**
* 渠道code * 渠道code
......
...@@ -18,7 +18,7 @@ public interface ChannelConfRepository extends JpaRepository<ChannelConf, Long> ...@@ -18,7 +18,7 @@ public interface ChannelConfRepository extends JpaRepository<ChannelConf, Long>
* @param channelId 用户名 * @param channelId 用户名
* @return * @return
*/ */
ChannelConf getByChannelId(Integer channelId); ChannelConf getByChannelId(Long channelId);
} }
package cn.quantgroup.cashloanflowboss.api.channel.service; package cn.quantgroup.cashloanflowboss.api.channel.service;
import java.util.Date; import java.util.*;
import cn.quantgroup.cashloanflowboss.api.channel.entity.boss.ChannelConf; import cn.quantgroup.cashloanflowboss.api.channel.entity.boss.ChannelConf;
import cn.quantgroup.cashloanflowboss.api.channel.model.ChannelListModel; import cn.quantgroup.cashloanflowboss.api.channel.model.ChannelListModel;
...@@ -15,9 +15,6 @@ import org.springframework.data.domain.PageRequest; ...@@ -15,9 +15,6 @@ import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.persistence.criteria.Predicate; import javax.persistence.criteria.Predicate;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/** /**
* function: * function:
...@@ -37,7 +34,7 @@ public class ChannelConfService { ...@@ -37,7 +34,7 @@ public class ChannelConfService {
public Page<ChannelListModel> getChannelInfo(Integer pageNumber, Integer pageSize, Integer channelId) { public Page<ChannelListModel> getChannelInfo(Integer pageNumber, Integer pageSize, Long channelId) {
Page<ChannelConfiguration> page = this.clfChannelConfigurationRepository.findAll((root, criteriaQuery, criteriaBuilder) -> { Page<ChannelConfiguration> page = this.clfChannelConfigurationRepository.findAll((root, criteriaQuery, criteriaBuilder) -> {
...@@ -45,9 +42,11 @@ public class ChannelConfService { ...@@ -45,9 +42,11 @@ public class ChannelConfService {
// 指定渠道号 // 指定渠道号
if (Objects.nonNull(channelId)) { if (Objects.nonNull(channelId)) {
predicates.add(criteriaBuilder.equal(root.get("channelId"), channelId)); predicates.add(criteriaBuilder.equal(root.get("registeredFrom"), channelId.longValue()));
} }
// 设置查询条件
criteriaQuery.where(criteriaBuilder.and(predicates.toArray(new Predicate[predicates.size()])));
// 指定排序 // 指定排序
criteriaQuery.orderBy(criteriaBuilder.desc(root.get("id"))); criteriaQuery.orderBy(criteriaBuilder.desc(root.get("id")));
...@@ -69,9 +68,9 @@ public class ChannelConfService { ...@@ -69,9 +68,9 @@ public class ChannelConfService {
} }
public Result getChannelConf(Integer channelId) { public Map<String, Object> getChannelConf(Long channelId) {
ChannelConf channelConf = channelConfRepository.getByChannelId(channelId); ChannelConf channelConf = channelConfRepository.getByChannelId(channelId);
return Result.buildSuccess(ChannelConfUtil.channelConfConvertVOModel(channelConf), "success"); return ChannelConfUtil.channelConfConvertVOModel(channelConf);
} }
......
...@@ -45,13 +45,14 @@ public class RoleDataLoadAspect { ...@@ -45,13 +45,14 @@ public class RoleDataLoadAspect {
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())) {
System.out.println(userSessionInfo.getChannelId()); args[0] = userSessionInfo.getChannelId();
} }
try { try {
return pjp.proceed(args); return pjp.proceed(args);
} catch (Throwable throwable) { } catch (Throwable throwable) {
return Result.buildFial(ExceptionUtils.getMessage(throwable)); System.out.println(ExceptionUtils.getStackTrace(throwable));
return "1";
} }
} }
......
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