Browse Source

客户查询

v1.0
15989082884@163.com 2 years ago
parent
commit
fcd91f0dd2
  1. 32
      src/main/java/com/qs/serve/modules/bms/controller/BmsSupplierController.java
  2. 143
      src/main/java/com/qs/serve/modules/bms/controller/my/BmsSupplierMyController.java
  3. 20
      src/main/java/com/qs/serve/modules/his/service/impl/HisUserSupplierServiceImpl.java
  4. 6
      src/main/resources/mapper/bms/BmsSupplierMapper.xml

32
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);
} }
@ -269,8 +269,6 @@ public class BmsSupplierController {
} }
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);

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);

20
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) {
param.setSearchInIds(supplierIds);
List<BmsSupplier> supplierList = bmsSupplierService.selectSupplierList(param);
return supplierList; 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