Browse Source

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

v1.0
Yen 2 years ago
parent
commit
d50967bcba
  1. 32
      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. 20
      src/main/java/com/qs/serve/modules/his/service/impl/HisUserSupplierServiceImpl.java
  6. 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());
}
// String userId = param.getUserId();
// if(param.getLoadByCurrent()!=null&&param.getLoadByCurrent().equals(1)){
// List<String> userIds = sysPostUserService.listByChildIds(userId);
// userIds.add(userId);
// param.setSelectUserIds(userIds);
// }else {
// param.setCurrUserId(userId);
// }
String userId = param.getUserId();
if(param.getLoadByCurrent()!=null&&param.getLoadByCurrent().equals(1)){
List<String> userIds = sysPostUserService.listByChildIds(userId);
userIds.add(userId);
param.setSelectUserIds(userIds);
}else {
param.setCurrUserId(userId);
}
if(StringUtils.hasText(param.getRegion2Label())){
LambdaQueryWrapper<BmsRegion2> region2LambdaQueryWrapper = new LambdaQueryWrapper<>();
@ -168,13 +168,13 @@ public class BmsSupplierController {
List<BmsSupplier> list = bmsSupplierService.selectSupplierList(param);
initSupplierList(list);
initParentList(list);
// for (BmsSupplier supplier : list) {
// supplier.setMasterFlag(0);
// if(supplier.getUserId()!=null&&supplier.getUserId().equals(userId)){
// supplier.setMasterFlag(1);
// break;
// }
// }
for (BmsSupplier supplier : list) {
supplier.setMasterFlag(0);
if(supplier.getUserId()!=null&&supplier.getUserId().equals(userId)){
supplier.setMasterFlag(1);
break;
}
}
return R.ok(list);
}
@ -269,8 +269,6 @@ public class BmsSupplierController {
}
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.setPageNum(param.getPageNum()+"");
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){
PageUtil.startPage();
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);
}
@ -73,6 +79,12 @@ public class BmsChannelMyController {
}
PageUtil.startPage();
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);
}

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

@ -75,6 +75,43 @@ public class BmsChannelPointMyController {
return R.byEmptyList();
}
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);
}
@ -122,6 +159,13 @@ public class BmsChannelPointMyController {
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);
}

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 java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@ -55,6 +56,77 @@ public class BmsSupplierMyController {
*/
@GetMapping("/page")
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);
initSupplierList(pageVo.getList());
return R.ok(pageVo);
@ -67,6 +139,77 @@ public class BmsSupplierMyController {
*/
@GetMapping("/underlingPage")
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());
param.setSelectUserIds(childIds);
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.lambda().in(HisUserSupplier::getUserId,userIds)
.ne(HisUserSupplier::getSupplierId,0);
if(CollectionUtil.isNotEmpty(param.getSearchInIds())){
lqw.lambda().in(HisUserSupplier::getSupplierId,param.getSearchInIds());
}
if(usePage){
PageUtil.startPage();
}
@ -84,18 +81,25 @@ public class HisUserSupplierServiceImpl extends ServiceImpl<HisUserSupplierMappe
@Override
public List<BmsSupplier> selectListSupplier(BmsSupplier param) {
List<HisUserSupplier> hisUserSuppliers = selectHisSupplier(param,false);
List<Long> supplierIds = hisUserSuppliers.stream().map(HisUserSupplier::getSupplierId).collect(Collectors.toList());
List<BmsSupplier> supplierList = bmsSupplierService.listByIds(supplierIds);
List<String> supplierIds = hisUserSuppliers.stream().map(a->a.getSupplierId().toString()).collect(Collectors.toList());
if(supplierIds.size()>0) {
param.setSearchInIds(supplierIds);
List<BmsSupplier> supplierList = bmsSupplierService.selectSupplierList(param);
return supplierList;
}else{
return new ArrayList<>();
}
}
@Override
public PageVo<BmsSupplier> selectPageSupplier(BmsSupplier param) {
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) {
List<BmsSupplier> supplierList = bmsSupplierService.listByIds(supplierIds);
return R.buildPageHelperList(hisUserSuppliers,supplierList);
param.setSearchInIds(supplierIds);
PageHelper.startPage(param.getPageNum(),param.getPageSize());
List<BmsSupplier> supplierList = bmsSupplierService.selectSupplierList(param);
return R.buildPageHelperList(supplierList);
}else{
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 != ''">
and (`bms_supplier`.`user_code` LIKE CONCAT('%',#{query.searchUserCode},'%') or `bms_supplier`.`other_user_codes` LIKE CONCAT('%',#{query.searchUserCode},'%') )
</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">
and bms_supplier.region_last in
<foreach collection="query.regionIds" item ="selectId" index="i" open="(" close=")" separator=",">

Loading…
Cancel
Save