From feea6a61a270993e5ec7899192d8719e631f70f4 Mon Sep 17 00:00:00 2001 From: xuhy <3313886187@qq.com> Date: 星期六, 13 九月 2025 14:58:02 +0800 Subject: [PATCH] 业务员导出 --- ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpSupplierWarehousingServiceImpl.java | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 102 insertions(+), 5 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpSupplierWarehousingServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpSupplierWarehousingServiceImpl.java index a59e213..63c6b2b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpSupplierWarehousingServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpSupplierWarehousingServiceImpl.java @@ -1,6 +1,7 @@ package com.ruoyi.system.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ruoyi.common.basic.PageInfo; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.utils.DateUtils; @@ -13,6 +14,8 @@ import com.ruoyi.system.query.TErpGoodsWarehouseQuery; import com.ruoyi.system.query.TErpInventoryQuery; import com.ruoyi.system.query.ValidityPeriodWarningQuery; +import com.ruoyi.system.service.TCrmClinicService; +import com.ruoyi.system.service.TCrmSupplierService; import com.ruoyi.system.service.TErpSupplierWarehousingService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.system.vo.*; @@ -70,6 +73,11 @@ @Resource private TErpGoodsUnitMapper erpGoodsUnitMapper; + @Resource + private TCrmClinicMapper crmClinicMapper; + + @Resource + private TCrmSupplierMapper crmSupplierMapper; @Override public PageInfo<TErpGoodsVO> pageList(TErpGoodsQuery query, SysUser user) { @@ -92,6 +100,23 @@ @Override public List<TErpGoodsWarehouseLastVO> detail(String id, String warehouseName, SysUser user) { + Integer roleType = user.getRoleType(); + String supplierClinicId = null; + if(roleType == 4){ + // 供应商 + TCrmSupplier crmSupplier = crmSupplierMapper.selectOne(Wrappers.lambdaQuery(TCrmSupplier.class) + .eq(TCrmSupplier::getUserId, user.getUserId()) + .last("LIMIT 1")); + supplierClinicId =crmSupplier.getId(); + } + if(roleType == 5){ + // 诊所 + TCrmClinic crmClinic = crmClinicMapper.selectOne(Wrappers.lambdaQuery(TCrmClinic.class) + .eq(TCrmClinic::getUserId, user.getUserId()) + .last("LIMIT 1")); + supplierClinicId =crmClinic.getId(); + } + TErpGoods goods = erpGoodsMapper.selectById(id); @@ -99,7 +124,7 @@ if(tCrmWarehouses.isEmpty()){ return Collections.emptyList(); } - List<TErpSupplierWarehousing> tErpSupplierWarehousings = erpSupplierWarehousingMapper.selectList(new LambdaQueryWrapper<TErpSupplierWarehousing>().in(TErpSupplierWarehousing::getWarehouseId, tCrmWarehouses.stream().map(TCrmWarehouse::getId).collect(Collectors.toList())).eq(TErpSupplierWarehousing::getSupplierId, user.getUserId()).eq(TErpSupplierWarehousing::getGoodsId, id)); + List<TErpSupplierWarehousing> tErpSupplierWarehousings = erpSupplierWarehousingMapper.selectList(new LambdaQueryWrapper<TErpSupplierWarehousing>().in(TErpSupplierWarehousing::getWarehouseId, tCrmWarehouses.stream().map(TCrmWarehouse::getId).collect(Collectors.toList())).eq(TErpSupplierWarehousing::getSupplierId, supplierClinicId).eq(TErpSupplierWarehousing::getGoodsId, id)); if(tErpSupplierWarehousings.isEmpty()){ return Collections.emptyList(); } @@ -155,6 +180,27 @@ @Override public PageInfo<TErpGoodsWarehouseRecordLastVO> pageWarehouseList(TErpGoodsWarehouseQuery query, SysUser user) { + + Integer roleType = user.getRoleType(); + String supplierClinicId = null; + if(roleType == 4){ + // 供应商 + TCrmSupplier crmSupplier = crmSupplierMapper.selectOne(Wrappers.lambdaQuery(TCrmSupplier.class) + .eq(TCrmSupplier::getUserId, user.getUserId()) + .last("LIMIT 1")); + supplierClinicId =crmSupplier.getId(); + } + if(roleType == 5){ + // 诊所 + TCrmClinic crmClinic = crmClinicMapper.selectOne(Wrappers.lambdaQuery(TCrmClinic.class) + .eq(TCrmClinic::getUserId, user.getUserId()) + .last("LIMIT 1")); + supplierClinicId =crmClinic.getId(); + } + query.setSupplierClinicId(supplierClinicId); + + + TErpGoods goods = erpGoodsMapper.selectById(query.getGoodsId()); PageInfo<TErpGoodsWarehouseRecordLastVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); @@ -202,12 +248,28 @@ @Override public void warehousingGoods(List<WarehousingGoodsDto> dtos, SysUser user) { + Integer roleType = user.getRoleType(); + String supplierClinicId = null; + if(roleType == 4){ + // 供应商 + TCrmSupplier crmSupplier = crmSupplierMapper.selectOne(Wrappers.lambdaQuery(TCrmSupplier.class) + .eq(TCrmSupplier::getUserId, user.getUserId()) + .last("LIMIT 1")); + supplierClinicId =crmSupplier.getId(); + } + if(roleType == 5){ + // 诊所 + TCrmClinic crmClinic = crmClinicMapper.selectOne(Wrappers.lambdaQuery(TCrmClinic.class) + .eq(TCrmClinic::getUserId, user.getUserId()) + .last("LIMIT 1")); + supplierClinicId =crmClinic.getId(); + } for (WarehousingGoodsDto dto : dtos) { TErpSupplierWarehousing tErpSupplierWarehousing = new TErpSupplierWarehousing(); // 当前年月日时分秒 String time = DateUtils.dateTimeNow(); tErpSupplierWarehousing.setWarehouseNo("G"+time); - tErpSupplierWarehousing.setSupplierId(user.getUserId().toString()); + tErpSupplierWarehousing.setSupplierId(supplierClinicId); tErpSupplierWarehousing.setWarehouseId(dto.getWarehouseId()); tErpSupplierWarehousing.setGoodsId(dto.getGoodsId()); TErpGoods goods = erpGoodsMapper.selectById(dto.getGoodsId()); @@ -228,7 +290,7 @@ if(goods.getMaintenanceInterval()!=null){ TErpMaintenanceReminder tErpMaintenanceReminder = new TErpMaintenanceReminder(); - tErpMaintenanceReminder.setClinicSupplierId(user.getUserId().toString()); + tErpMaintenanceReminder.setClinicSupplierId(supplierClinicId); tErpMaintenanceReminder.setMaintenanceType(1); tErpMaintenanceReminder.setWarehousingBatchId(tErpSupplierWarehousingBatch.getId()); Integer day = Integer.valueOf(goods.getMaintenanceInterval()); @@ -245,17 +307,52 @@ @Override public PageInfo<ValidityPeriodWarningVo> validityPeriodWarning(ValidityPeriodWarningQuery query, SysUser user) { + Integer roleType = user.getRoleType(); + String supplierClinicId = null; + if(roleType == 4){ + // 供应商 + TCrmSupplier crmSupplier = crmSupplierMapper.selectOne(Wrappers.lambdaQuery(TCrmSupplier.class) + .eq(TCrmSupplier::getUserId, user.getUserId()) + .last("LIMIT 1")); + supplierClinicId =crmSupplier.getId(); + } + if(roleType == 5){ + // 诊所 + TCrmClinic crmClinic = crmClinicMapper.selectOne(Wrappers.lambdaQuery(TCrmClinic.class) + .eq(TCrmClinic::getUserId, user.getUserId()) + .last("LIMIT 1")); + supplierClinicId =crmClinic.getId(); + } // 获取当前时间后9个月的时间 LocalDateTime nineMonthLater = LocalDateTime.now().plusMonths(9); PageInfo<ValidityPeriodWarningVo> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); - return this.baseMapper.validityPeriodWarning(pageInfo,query,user,nineMonthLater); + + + + return this.baseMapper.validityPeriodWarning(pageInfo,query,user,nineMonthLater,supplierClinicId); } @Override public PageInfo<PageInventoryListVo> pageInventoryList(TErpInventoryQuery query, SysUser user) { + Integer roleType = user.getRoleType(); + String supplierClinicId = null; + if(roleType == 4){ + // 供应商 + TCrmSupplier crmSupplier = crmSupplierMapper.selectOne(Wrappers.lambdaQuery(TCrmSupplier.class) + .eq(TCrmSupplier::getUserId, user.getUserId()) + .last("LIMIT 1")); + supplierClinicId =crmSupplier.getId(); + } + if(roleType == 5){ + // 诊所 + TCrmClinic crmClinic = crmClinicMapper.selectOne(Wrappers.lambdaQuery(TCrmClinic.class) + .eq(TCrmClinic::getUserId, user.getUserId()) + .last("LIMIT 1")); + supplierClinicId =crmClinic.getId(); + } String sTime=null; String eTime =null; if(query.getTime()!=null && !query.getTime().isEmpty()){ @@ -264,7 +361,7 @@ eTime = split[1] + " 23:59:59"; } PageInfo<PageInventoryListVo> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); - List<PageInventoryListVo> list = this.baseMapper.pageInventoryList(pageInfo,query,user,sTime,eTime); + List<PageInventoryListVo> list = this.baseMapper.pageInventoryList(pageInfo,query,user,sTime,eTime,supplierClinicId); if(list.isEmpty()){ return pageInfo; } -- Gitblit v1.7.1