11 changed files with 192 additions and 5 deletions
@ -0,0 +1,129 @@ |
|||
package com.qs.serve.modules.bms.controller; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.qs.serve.common.model.annotation.SysLog; |
|||
import com.qs.serve.common.model.dto.PageVo; |
|||
import com.qs.serve.common.model.dto.R; |
|||
import com.qs.serve.common.model.enums.BizType; |
|||
import com.qs.serve.common.model.enums.SystemModule; |
|||
import com.qs.serve.common.util.PageUtil; |
|||
import com.qs.serve.modules.bms.entity.BmsChannel; |
|||
import com.qs.serve.modules.bms.entity.BmsChannelPoint; |
|||
import com.qs.serve.modules.bms.entity.BmsSupplier; |
|||
import com.qs.serve.modules.bms.entity.BmsSupplierChannel; |
|||
import com.qs.serve.modules.bms.entity.bo.BmsSupplierChannelBo; |
|||
import com.qs.serve.modules.bms.service.BmsChannelPointService; |
|||
import com.qs.serve.modules.bms.service.BmsChannelService; |
|||
import com.qs.serve.modules.bms.service.BmsSupplierChannelService; |
|||
import com.qs.serve.modules.bms.service.BmsSupplierService; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.validation.Valid; |
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* 基础档案 客户渠道关系2 |
|||
* @author YenHex |
|||
* @since 2022-11-03 |
|||
*/ |
|||
@Slf4j |
|||
@AllArgsConstructor |
|||
@RestController |
|||
@RequestMapping("bms/supplierRelate") |
|||
public class BmsSupplierChannelPointController { |
|||
|
|||
private BmsSupplierChannelService bmsSupplierChannelService; |
|||
private BmsChannelService bmsChannelService; |
|||
private BmsChannelPointService bmsChannelPointService; |
|||
private BmsSupplierService bmsSupplierService; |
|||
|
|||
|
|||
/** |
|||
* 供应商ID加载渠道列表 |
|||
* @param supplierId |
|||
* @return |
|||
*/ |
|||
@GetMapping("/listChannelBySupplier") |
|||
public R<List<BmsChannel>> listChannelBySupplier(String supplierId,BmsChannel query){ |
|||
LambdaQueryWrapper<BmsSupplierChannel> lqw = new LambdaQueryWrapper<>(); |
|||
lqw.eq(BmsSupplierChannel::getSupplierId,supplierId); |
|||
List<BmsSupplierChannel> supplierChannels = bmsSupplierChannelService.list(lqw); |
|||
List<Long> channelIds = supplierChannels.stream().map(BmsSupplierChannel::getChannelId).distinct().collect(Collectors.toList()); |
|||
if(channelIds.size()<1){ |
|||
return R.ok(); |
|||
} |
|||
LambdaQueryWrapper<BmsChannel> lqw2 = new LambdaQueryWrapper<>(query); |
|||
lqw2.in(BmsChannel::getId,channelIds); |
|||
List<BmsChannel> bmsChannels = bmsChannelService.list(lqw2); |
|||
return R.ok(bmsChannels); |
|||
} |
|||
|
|||
/** |
|||
* 供应商ID加载渠道列表 |
|||
* @param supplierId |
|||
* @return |
|||
*/ |
|||
@GetMapping("/pageChannelBySupplier") |
|||
public R<PageVo<BmsChannel>> pageChannelBySupplier(String supplierId,BmsChannel query){ |
|||
LambdaQueryWrapper<BmsSupplierChannel> lqw = new LambdaQueryWrapper<>(); |
|||
lqw.eq(BmsSupplierChannel::getSupplierId,supplierId); |
|||
List<BmsSupplierChannel> supplierChannels = bmsSupplierChannelService.list(lqw); |
|||
List<Long> channelIds = supplierChannels.stream().map(BmsSupplierChannel::getChannelId).distinct().collect(Collectors.toList()); |
|||
if(channelIds.size()<1){ |
|||
return R.byEmptyList(); |
|||
} |
|||
PageUtil.startPage(); |
|||
LambdaQueryWrapper<BmsChannel> lqw2 = new LambdaQueryWrapper<>(query); |
|||
lqw2.in(BmsChannel::getId,channelIds); |
|||
List<BmsChannel> bmsChannels = bmsChannelService.list(lqw2); |
|||
return R.byPageHelperList(bmsChannels); |
|||
} |
|||
|
|||
/** |
|||
* 供应商ID加载网点列表 |
|||
* @param supplierId |
|||
* @return |
|||
*/ |
|||
@GetMapping("/listPointBySupplier") |
|||
public R<List<BmsChannelPoint>> listPointBySupplier(String supplierId,BmsChannelPoint query){ |
|||
LambdaQueryWrapper<BmsSupplierChannel> lqw = new LambdaQueryWrapper<>(); |
|||
lqw.eq(BmsSupplierChannel::getSupplierId,supplierId); |
|||
List<BmsSupplierChannel> supplierChannels = bmsSupplierChannelService.list(lqw); |
|||
List<Long> channelIds = supplierChannels.stream().map(BmsSupplierChannel::getChannelId).distinct().collect(Collectors.toList()); |
|||
if(channelIds.size()<1){ |
|||
return R.ok(); |
|||
} |
|||
LambdaQueryWrapper<BmsChannelPoint> lqw2 = new LambdaQueryWrapper<>(query); |
|||
lqw2.in(BmsChannelPoint::getChannelId,channelIds); |
|||
List<BmsChannelPoint> channelPoints = bmsChannelPointService.list(lqw2); |
|||
return R.ok(channelPoints); |
|||
} |
|||
|
|||
/** |
|||
* 供应商ID加载网点列表 |
|||
* @param supplierId |
|||
* @return |
|||
*/ |
|||
@GetMapping("/pagePointBySupplier") |
|||
public R<PageVo<BmsChannelPoint>> pagePointBySupplier(String supplierId,BmsChannelPoint query){ |
|||
LambdaQueryWrapper<BmsSupplierChannel> lqw = new LambdaQueryWrapper<>(); |
|||
lqw.eq(BmsSupplierChannel::getSupplierId,supplierId); |
|||
List<BmsSupplierChannel> supplierChannels = bmsSupplierChannelService.list(lqw); |
|||
List<Long> channelIds = supplierChannels.stream().map(BmsSupplierChannel::getChannelId).distinct().collect(Collectors.toList()); |
|||
if(channelIds.size()<1){ |
|||
return R.byEmptyList(); |
|||
} |
|||
PageUtil.startPage(); |
|||
LambdaQueryWrapper<BmsChannelPoint> lqw2 = new LambdaQueryWrapper<>(query); |
|||
lqw2.in(BmsChannelPoint::getChannelId,channelIds); |
|||
List<BmsChannelPoint> channelPoints = bmsChannelPointService.list(lqw2); |
|||
return R.byPageHelperList(channelPoints); |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.tbs.common.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/5/16 |
|||
*/ |
|||
@Data |
|||
public class CompensateDTO { |
|||
|
|||
String id; |
|||
|
|||
} |
Loading…
Reference in new issue