Browse Source

Merge remote-tracking branch 'origin/v1.0' into v1.0

v1.0
Yen 2 years ago
parent
commit
d50967bcba
  1. 34
      src/main/java/com/qs/serve/modules/bms/controller/BmsSupplierController.java
  2. 12
      src/main/java/com/qs/serve/modules/bms/controller/my/BmsChannelMyController.java
  3. 44
      src/main/java/com/qs/serve/modules/bms/controller/my/BmsChannelPointMyController.java
  4. 143
      src/main/java/com/qs/serve/modules/bms/controller/my/BmsSupplierMyController.java
  5. 22
      src/main/java/com/qs/serve/modules/his/service/impl/HisUserSupplierServiceImpl.java
  6. 6
      src/main/resources/mapper/bms/BmsSupplierMapper.xml

34
src/main/java/com/qs/serve/modules/bms/controller/BmsSupplierController.java

@ -84,14 +84,14 @@ public class BmsSupplierController {
param.setCode(param.getSupplierCode()); param.setCode(param.getSupplierCode());
} }
// String userId = param.getUserId(); String userId = param.getUserId();
// if(param.getLoadByCurrent()!=null&&param.getLoadByCurrent().equals(1)){ if(param.getLoadByCurrent()!=null&&param.getLoadByCurrent().equals(1)){
// List<String> userIds = sysPostUserService.listByChildIds(userId); List<String> userIds = sysPostUserService.listByChildIds(userId);
// userIds.add(userId); userIds.add(userId);
// param.setSelectUserIds(userIds); param.setSelectUserIds(userIds);
// }else { }else {
// param.setCurrUserId(userId); param.setCurrUserId(userId);
// } }
if(StringUtils.hasText(param.getRegion2Label())){ if(StringUtils.hasText(param.getRegion2Label())){
LambdaQueryWrapper<BmsRegion2> region2LambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<BmsRegion2> region2LambdaQueryWrapper = new LambdaQueryWrapper<>();
@ -168,13 +168,13 @@ public class BmsSupplierController {
List<BmsSupplier> list = bmsSupplierService.selectSupplierList(param); List<BmsSupplier> list = bmsSupplierService.selectSupplierList(param);
initSupplierList(list); initSupplierList(list);
initParentList(list); initParentList(list);
// for (BmsSupplier supplier : list) { for (BmsSupplier supplier : list) {
// supplier.setMasterFlag(0); supplier.setMasterFlag(0);
// if(supplier.getUserId()!=null&&supplier.getUserId().equals(userId)){ if(supplier.getUserId()!=null&&supplier.getUserId().equals(userId)){
// supplier.setMasterFlag(1); supplier.setMasterFlag(1);
// break; break;
// } }
// } }
return R.ok(list); return R.ok(list);
} }
@ -266,11 +266,9 @@ public class BmsSupplierController {
}else{ }else{
param.setSearchRegionSecond(Arrays.asList("#")); param.setSearchRegionSecond(Arrays.asList("#"));
} }
} }
if(param.getLoadByCurrent()!=null&&param.getLoadByCurrent().equals(1)){ if(param.getLoadByCurrent()!=null&&param.getLoadByCurrent().equals(1)){
List<BmsSupplier> list = bmsSupplierService.selectSupplierList(param);
param.setSearchInIds(list.stream().map(a->a.getId()).collect(Collectors.toList()));
PageUtil.setPageSize(param.getPageSize()+""); PageUtil.setPageSize(param.getPageSize()+"");
PageUtil.setPageNum(param.getPageNum()+""); PageUtil.setPageNum(param.getPageNum()+"");
return supplierMyController.getUnderlingAndMinePage(param); return supplierMyController.getUnderlingAndMinePage(param);

12
src/main/java/com/qs/serve/modules/bms/controller/my/BmsChannelMyController.java

@ -55,6 +55,12 @@ public class BmsChannelMyController {
public R<PageVo<BmsChannel>> getPage(BmsChannel param){ public R<PageVo<BmsChannel>> getPage(BmsChannel param){
PageUtil.startPage(); PageUtil.startPage();
List<BmsChannel> list = bmsChannelService.selectChannelList(param, Arrays.asList(AuthContextUtils.getSysUserId()),null); List<BmsChannel> list = bmsChannelService.selectChannelList(param, Arrays.asList(AuthContextUtils.getSysUserId()),null);
list.forEach(a->{
BmsSupplierChannel searchSupplierChannel = new BmsSupplierChannel();
searchSupplierChannel.setChannelId(a.getId());
List<BmsSupplierChannel> bmsSupplierChannelList = bmsSupplierChannelService.selectSupplierChannelList(searchSupplierChannel);
a.setSupplierNames(bmsSupplierChannelList.stream().map(b->b.getSupplierName()).collect(Collectors.toList()));
});
return R.byPageHelperList(list); return R.byPageHelperList(list);
} }
@ -73,6 +79,12 @@ public class BmsChannelMyController {
} }
PageUtil.startPage(); PageUtil.startPage();
List<BmsChannel> list = bmsChannelService.selectChannelList(param, userIds,null); List<BmsChannel> list = bmsChannelService.selectChannelList(param, userIds,null);
list.forEach(a->{
BmsSupplierChannel searchSupplierChannel = new BmsSupplierChannel();
searchSupplierChannel.setChannelId(a.getId());
List<BmsSupplierChannel> bmsSupplierChannelList = bmsSupplierChannelService.selectSupplierChannelList(searchSupplierChannel);
a.setSupplierNames(bmsSupplierChannelList.stream().map(b->b.getSupplierName()).collect(Collectors.toList()));
});
return R.byPageHelperList(list); return R.byPageHelperList(list);
} }

44
src/main/java/com/qs/serve/modules/bms/controller/my/BmsChannelPointMyController.java

@ -75,6 +75,43 @@ public class BmsChannelPointMyController {
return R.byEmptyList(); return R.byEmptyList();
} }
List<BmsChannelPoint> list = bmsChannelPointService.selectChannelPointMyList(param, Arrays.asList(AuthContextUtils.getSysUserId())); List<BmsChannelPoint> list = bmsChannelPointService.selectChannelPointMyList(param, Arrays.asList(AuthContextUtils.getSysUserId()));
List<String> bizRegionIds = new ArrayList<>();
bizRegionIds.addAll(list.stream().filter(a->a.getBizRegionId()!=null).map(a->a.getBizRegionId()).collect(Collectors.toList()));
bizRegionIds = bizRegionIds.stream().distinct().collect(Collectors.toList());
List<BmsRegion2> region2List = new ArrayList<>();
if(bizRegionIds.size()>0){
LambdaQueryWrapper<BmsRegion2> region2LambdaQueryWrapper = new LambdaQueryWrapper<>();
region2LambdaQueryWrapper.in(BmsRegion2::getId,bizRegionIds);
region2List = bmsRegion2Service.list(region2LambdaQueryWrapper);
}
Map<String,BmsRegion2> idToBizRegion = region2List.stream().collect(Collectors.toMap(BmsRegion2::getId, a->a));
for (BmsChannelPoint channelPoint : list) {
if(StringUtils.hasText(channelPoint.getBizRegionPath())){
String[] bizRegions = channelPoint.getBizRegionPath().split("_");
if(bizRegions.length>0){
channelPoint.setBizRegionName(bizRegions[bizRegions.length-1]);
}
BmsRegion2 region2 = idToBizRegion.get(channelPoint.getBizRegionId());
if(region2!=null){
channelPoint.setBizRegionCode(region2.getCode());
}
}
if(StringUtils.hasText(channelPoint.getSaleRegionPath())){
String[] regions = channelPoint.getSaleRegionPath().split("_");
if(regions.length>0){
channelPoint.setSaleRegionName(regions[regions.length-1]);
}
}
BmsSupplierChannel searchSupplierChannel = new BmsSupplierChannel();
searchSupplierChannel.setChannelId(channelPoint.getChannelId());
List<BmsSupplierChannel> bmsSupplierChannelList = bmsSupplierChannelService.selectSupplierChannelList(searchSupplierChannel);
channelPoint.setSupplierNames(bmsSupplierChannelList.stream().map(b->b.getSupplierName()).collect(Collectors.toList()));
}
return R.byPageList(count,list); return R.byPageList(count,list);
} }
@ -122,6 +159,13 @@ public class BmsChannelPointMyController {
channelPoint.setSaleRegionName(regions[regions.length-1]); channelPoint.setSaleRegionName(regions[regions.length-1]);
} }
} }
BmsSupplierChannel searchSupplierChannel = new BmsSupplierChannel();
searchSupplierChannel.setChannelId(channelPoint.getChannelId());
List<BmsSupplierChannel> bmsSupplierChannelList = bmsSupplierChannelService.selectSupplierChannelList(searchSupplierChannel);
channelPoint.setSupplierNames(bmsSupplierChannelList.stream().map(b->b.getSupplierName()).collect(Collectors.toList()));
} }
return R.byPageList(count,pageList); return R.byPageList(count,pageList);
} }

143
src/main/java/com/qs/serve/modules/bms/controller/my/BmsSupplierMyController.java

@ -27,6 +27,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -55,6 +56,77 @@ public class BmsSupplierMyController {
*/ */
@GetMapping("/page") @GetMapping("/page")
public R<PageVo<BmsSupplier>> getPage(BmsSupplier param){ public R<PageVo<BmsSupplier>> getPage(BmsSupplier param){
if(StringUtils.hasText(param.getRegion2Label())){
LambdaQueryWrapper<BmsRegion2> region2LambdaQueryWrapper = new LambdaQueryWrapper<>();
region2LambdaQueryWrapper.like(BmsRegion2::getPathNames,param.getRegion2Label());
List<BmsRegion2> region2List = bmsRegion2Service.list(region2LambdaQueryWrapper);
if(region2List.size()>0) {
param.setRegion2Ids(region2List.stream().map(a -> a.getId()).collect(Collectors.toList()));
}else{
param.setRegion2Ids(Arrays.asList("#"));
}
}
if(StringUtils.hasText(param.getSearchRegion2FirstName())){
LambdaQueryWrapper<BmsRegion2> region2LambdaQueryWrapper = new LambdaQueryWrapper<>();
region2LambdaQueryWrapper.like(BmsRegion2::getName,param.getSearchRegion2FirstName());
List<BmsRegion2> region2List = bmsRegion2Service.list(region2LambdaQueryWrapper);
if(region2List.size()>0) {
param.setSearchRegion2First(region2List.stream().map(a -> a.getId()).collect(Collectors.toList()));
}else{
param.setSearchRegion2First(Arrays.asList("#"));
}
}
if(StringUtils.hasText(param.getSearchRegion2SecondName())){
LambdaQueryWrapper<BmsRegion2> region2LambdaQueryWrapper = new LambdaQueryWrapper<>();
region2LambdaQueryWrapper.like(BmsRegion2::getName,param.getSearchRegion2SecondName());
List<BmsRegion2> region2List = bmsRegion2Service.list(region2LambdaQueryWrapper);
if(region2List.size()>0) {
param.setSearchRegion2Second(region2List.stream().map(a -> a.getId()).collect(Collectors.toList()));
}else{
param.setSearchRegion2Second(Arrays.asList("#"));
}
}
if(StringUtils.hasText(param.getSearchRegion2ThirdName())){
LambdaQueryWrapper<BmsRegion2> region2LambdaQueryWrapper = new LambdaQueryWrapper<>();
region2LambdaQueryWrapper.like(BmsRegion2::getName,param.getSearchRegion2ThirdName());
List<BmsRegion2> region2List = bmsRegion2Service.list(region2LambdaQueryWrapper);
if(region2List.size()>0) {
param.setSearchRegion2Third(region2List.stream().map(a -> a.getId()).collect(Collectors.toList()));
}else{
param.setSearchRegion2Third(Arrays.asList("#"));
}
}
if(StringUtils.hasText(param.getRegionLabel())){
LambdaQueryWrapper<BmsRegion> regionLambdaQueryWrapper = new LambdaQueryWrapper<>();
regionLambdaQueryWrapper.like(BmsRegion::getPathNames,param.getRegionLabel());
List<BmsRegion> regionList = bmsRegionService.list(regionLambdaQueryWrapper);
if(regionList.size()>0) {
param.setRegionIds(regionList.stream().map(a -> a.getId()).collect(Collectors.toList()));
}else{
param.setRegion2Ids(Arrays.asList("#"));
}
}
if(StringUtils.hasText(param.getSearchRegionFirstName())){
LambdaQueryWrapper<BmsRegion> regionLambdaQueryWrapper = new LambdaQueryWrapper<>();
regionLambdaQueryWrapper.like(BmsRegion::getName,param.getSearchRegionFirstName());
List<BmsRegion> regionList = bmsRegionService.list(regionLambdaQueryWrapper);
if(regionList.size()>0) {
param.setSearchRegionFirst(regionList.stream().map(a -> a.getId()).collect(Collectors.toList()));
}else{
param.setSearchRegionFirst(Arrays.asList("#"));
}
}
if(StringUtils.hasText(param.getSearchRegionSecondName())){
LambdaQueryWrapper<BmsRegion> regionLambdaQueryWrapper = new LambdaQueryWrapper<>();
regionLambdaQueryWrapper.like(BmsRegion::getName,param.getSearchRegionSecondName());
List<BmsRegion> regionList = bmsRegionService.list(regionLambdaQueryWrapper);
if(regionList.size()>0) {
param.setSearchRegionSecond(regionList.stream().map(a -> a.getId()).collect(Collectors.toList()));
}else{
param.setSearchRegionSecond(Arrays.asList("#"));
}
}
PageVo<BmsSupplier> pageVo = hisUserSupplierService.selectPageSupplier(param); PageVo<BmsSupplier> pageVo = hisUserSupplierService.selectPageSupplier(param);
initSupplierList(pageVo.getList()); initSupplierList(pageVo.getList());
return R.ok(pageVo); return R.ok(pageVo);
@ -67,6 +139,77 @@ public class BmsSupplierMyController {
*/ */
@GetMapping("/underlingPage") @GetMapping("/underlingPage")
public R<PageVo<BmsSupplier>> getUnderlingPage(BmsSupplier param){ public R<PageVo<BmsSupplier>> getUnderlingPage(BmsSupplier param){
if(StringUtils.hasText(param.getRegion2Label())){
LambdaQueryWrapper<BmsRegion2> region2LambdaQueryWrapper = new LambdaQueryWrapper<>();
region2LambdaQueryWrapper.like(BmsRegion2::getPathNames,param.getRegion2Label());
List<BmsRegion2> region2List = bmsRegion2Service.list(region2LambdaQueryWrapper);
if(region2List.size()>0) {
param.setRegion2Ids(region2List.stream().map(a -> a.getId()).collect(Collectors.toList()));
}else{
param.setRegion2Ids(Arrays.asList("#"));
}
}
if(StringUtils.hasText(param.getSearchRegion2FirstName())){
LambdaQueryWrapper<BmsRegion2> region2LambdaQueryWrapper = new LambdaQueryWrapper<>();
region2LambdaQueryWrapper.like(BmsRegion2::getName,param.getSearchRegion2FirstName());
List<BmsRegion2> region2List = bmsRegion2Service.list(region2LambdaQueryWrapper);
if(region2List.size()>0) {
param.setSearchRegion2First(region2List.stream().map(a -> a.getId()).collect(Collectors.toList()));
}else{
param.setSearchRegion2First(Arrays.asList("#"));
}
}
if(StringUtils.hasText(param.getSearchRegion2SecondName())){
LambdaQueryWrapper<BmsRegion2> region2LambdaQueryWrapper = new LambdaQueryWrapper<>();
region2LambdaQueryWrapper.like(BmsRegion2::getName,param.getSearchRegion2SecondName());
List<BmsRegion2> region2List = bmsRegion2Service.list(region2LambdaQueryWrapper);
if(region2List.size()>0) {
param.setSearchRegion2Second(region2List.stream().map(a -> a.getId()).collect(Collectors.toList()));
}else{
param.setSearchRegion2Second(Arrays.asList("#"));
}
}
if(StringUtils.hasText(param.getSearchRegion2ThirdName())){
LambdaQueryWrapper<BmsRegion2> region2LambdaQueryWrapper = new LambdaQueryWrapper<>();
region2LambdaQueryWrapper.like(BmsRegion2::getName,param.getSearchRegion2ThirdName());
List<BmsRegion2> region2List = bmsRegion2Service.list(region2LambdaQueryWrapper);
if(region2List.size()>0) {
param.setSearchRegion2Third(region2List.stream().map(a -> a.getId()).collect(Collectors.toList()));
}else{
param.setSearchRegion2Third(Arrays.asList("#"));
}
}
if(StringUtils.hasText(param.getRegionLabel())){
LambdaQueryWrapper<BmsRegion> regionLambdaQueryWrapper = new LambdaQueryWrapper<>();
regionLambdaQueryWrapper.like(BmsRegion::getPathNames,param.getRegionLabel());
List<BmsRegion> regionList = bmsRegionService.list(regionLambdaQueryWrapper);
if(regionList.size()>0) {
param.setRegionIds(regionList.stream().map(a -> a.getId()).collect(Collectors.toList()));
}else{
param.setRegion2Ids(Arrays.asList("#"));
}
}
if(StringUtils.hasText(param.getSearchRegionFirstName())){
LambdaQueryWrapper<BmsRegion> regionLambdaQueryWrapper = new LambdaQueryWrapper<>();
regionLambdaQueryWrapper.like(BmsRegion::getName,param.getSearchRegionFirstName());
List<BmsRegion> regionList = bmsRegionService.list(regionLambdaQueryWrapper);
if(regionList.size()>0) {
param.setSearchRegionFirst(regionList.stream().map(a -> a.getId()).collect(Collectors.toList()));
}else{
param.setSearchRegionFirst(Arrays.asList("#"));
}
}
if(StringUtils.hasText(param.getSearchRegionSecondName())){
LambdaQueryWrapper<BmsRegion> regionLambdaQueryWrapper = new LambdaQueryWrapper<>();
regionLambdaQueryWrapper.like(BmsRegion::getName,param.getSearchRegionSecondName());
List<BmsRegion> regionList = bmsRegionService.list(regionLambdaQueryWrapper);
if(regionList.size()>0) {
param.setSearchRegionSecond(regionList.stream().map(a -> a.getId()).collect(Collectors.toList()));
}else{
param.setSearchRegionSecond(Arrays.asList("#"));
}
}
List<String> childIds = postUserService.listByChildIds(AuthContextUtils.getSysUserId()); List<String> childIds = postUserService.listByChildIds(AuthContextUtils.getSysUserId());
param.setSelectUserIds(childIds); param.setSelectUserIds(childIds);
param.setSelectUserIdsFlag(true); param.setSelectUserIdsFlag(true);

22
src/main/java/com/qs/serve/modules/his/service/impl/HisUserSupplierServiceImpl.java

@ -72,9 +72,6 @@ public class HisUserSupplierServiceImpl extends ServiceImpl<HisUserSupplierMappe
lqw.select("distinct his_user_supplier.supplier_id"); lqw.select("distinct his_user_supplier.supplier_id");
lqw.lambda().in(HisUserSupplier::getUserId,userIds) lqw.lambda().in(HisUserSupplier::getUserId,userIds)
.ne(HisUserSupplier::getSupplierId,0); .ne(HisUserSupplier::getSupplierId,0);
if(CollectionUtil.isNotEmpty(param.getSearchInIds())){
lqw.lambda().in(HisUserSupplier::getSupplierId,param.getSearchInIds());
}
if(usePage){ if(usePage){
PageUtil.startPage(); PageUtil.startPage();
} }
@ -84,18 +81,25 @@ public class HisUserSupplierServiceImpl extends ServiceImpl<HisUserSupplierMappe
@Override @Override
public List<BmsSupplier> selectListSupplier(BmsSupplier param) { public List<BmsSupplier> selectListSupplier(BmsSupplier param) {
List<HisUserSupplier> hisUserSuppliers = selectHisSupplier(param,false); List<HisUserSupplier> hisUserSuppliers = selectHisSupplier(param,false);
List<Long> supplierIds = hisUserSuppliers.stream().map(HisUserSupplier::getSupplierId).collect(Collectors.toList()); List<String> supplierIds = hisUserSuppliers.stream().map(a->a.getSupplierId().toString()).collect(Collectors.toList());
List<BmsSupplier> supplierList = bmsSupplierService.listByIds(supplierIds); if(supplierIds.size()>0) {
return supplierList; param.setSearchInIds(supplierIds);
List<BmsSupplier> supplierList = bmsSupplierService.selectSupplierList(param);
return supplierList;
}else{
return new ArrayList<>();
}
} }
@Override @Override
public PageVo<BmsSupplier> selectPageSupplier(BmsSupplier param) { public PageVo<BmsSupplier> selectPageSupplier(BmsSupplier param) {
List<HisUserSupplier> hisUserSuppliers = selectHisSupplier(param,true); List<HisUserSupplier> hisUserSuppliers = selectHisSupplier(param,true);
List<Long> supplierIds = hisUserSuppliers.stream().map(HisUserSupplier::getSupplierId).collect(Collectors.toList()); List<String> supplierIds = hisUserSuppliers.stream().map(a->a.getSupplierId().toString()).collect(Collectors.toList());
if(supplierIds.size()>0) { if(supplierIds.size()>0) {
List<BmsSupplier> supplierList = bmsSupplierService.listByIds(supplierIds); param.setSearchInIds(supplierIds);
return R.buildPageHelperList(hisUserSuppliers,supplierList); PageHelper.startPage(param.getPageNum(),param.getPageSize());
List<BmsSupplier> supplierList = bmsSupplierService.selectSupplierList(param);
return R.buildPageHelperList(supplierList);
}else{ }else{
return R.buildPageHelperList(new ArrayList<>()); return R.buildPageHelperList(new ArrayList<>());
} }

6
src/main/resources/mapper/bms/BmsSupplierMapper.xml

@ -105,6 +105,12 @@
<if test="query.searchUserCode!=null and query.searchUserCode != ''"> <if test="query.searchUserCode!=null and query.searchUserCode != ''">
and (`bms_supplier`.`user_code` LIKE CONCAT('%',#{query.searchUserCode},'%') or `bms_supplier`.`other_user_codes` LIKE CONCAT('%',#{query.searchUserCode},'%') ) and (`bms_supplier`.`user_code` LIKE CONCAT('%',#{query.searchUserCode},'%') or `bms_supplier`.`other_user_codes` LIKE CONCAT('%',#{query.searchUserCode},'%') )
</if> </if>
<if test="query.searchInIds!=null and query.searchInIds.size > 0">
and bms_supplier.id in
<foreach collection="query.searchInIds" item ="selectId" index="i" open="(" close=")" separator=",">
#{selectId}
</foreach>
</if>
<if test="query.regionIds!=null and query.regionIds.size > 0"> <if test="query.regionIds!=null and query.regionIds.size > 0">
and bms_supplier.region_last in and bms_supplier.region_last in
<foreach collection="query.regionIds" item ="selectId" index="i" open="(" close=")" separator=","> <foreach collection="query.regionIds" item ="selectId" index="i" open="(" close=")" separator=",">

Loading…
Cancel
Save