From f8d30932873605f5eb407228b22a38ec5ff96af9 Mon Sep 17 00:00:00 2001 From: liujie <1793218484@qq.com> Date: 星期五, 12 九月 2025 15:57:28 +0800 Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/haizhentong --- ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpGoodsServiceImpl.java | 53 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 49 insertions(+), 4 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpGoodsServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpGoodsServiceImpl.java index 23a295c..2a29529 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpGoodsServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpGoodsServiceImpl.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.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.common.basic.PageInfo; import com.ruoyi.common.core.domain.entity.SysUser; @@ -20,7 +21,9 @@ import javax.annotation.Resource; import java.math.BigDecimal; +import java.time.LocalDateTime; import java.util.Collections; +import java.util.Date; import java.util.List; import java.util.stream.Collectors; @@ -58,6 +61,12 @@ @Resource private TErpSupplierOutboundGoodsMapper erpSupplierOutboundGoodsMapper; + + @Resource + private TCrmClinicMapper crmClinicMapper; + + @Resource + private TCrmSupplierMapper crmSupplierMapper; @Override @@ -122,8 +131,28 @@ @Override public PageInfo<TErpGoodsInventoryVO> pageInventoryGoodsPageList(TErpGoodsInventoryQuery 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(); + } + + // 当前时间一个月后 + Date endDate = DateUtils.addMonths(DateUtils.getNowDate(), 1); + PageInfo<TErpGoodsInventoryVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); - List<TErpGoodsInventoryVO> list = this.baseMapper.pageInventoryGoodsPageList(query, pageInfo, user); + List<TErpGoodsInventoryVO> list = this.baseMapper.pageInventoryGoodsPageList(query, pageInfo, user,supplierClinicId,endDate); if (list.isEmpty()) { return pageInfo; } @@ -148,11 +177,27 @@ @Override public void inventoryGoods(InventoryDto dto, 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(); + } TErpSupplierInventory tErpSupplierInventory = new TErpSupplierInventory(); String s = DateUtils.dateTimeNow(); tErpSupplierInventory.setInventoryNumber("P" + s); tErpSupplierInventory.setWarehouseId(dto.getWarehouseId()); - tErpSupplierInventory.setSupplierId(String.valueOf(user.getUserId())); + tErpSupplierInventory.setSupplierId(supplierClinicId); erpSupplierInventoryMapper.insert(tErpSupplierInventory); List<InventoryGoodsDto> dtos = dto.getDtos(); @@ -168,7 +213,7 @@ if (inventoryGoodsDto.getNum() < inventoryGoodsDto.getInventoryCount()) { // 添加入库信息 tErpSupplierWarehousing.setWarehouseId(dto.getWarehouseId()); - tErpSupplierWarehousing.setSupplierId(String.valueOf(user.getUserId())); + tErpSupplierWarehousing.setSupplierId(supplierClinicId); tErpSupplierWarehousing.setGoodsId(tErpSupplierWarehousing1.getGoodsId()); tErpSupplierWarehousing.setGoodsName(erpGoods.getGoodsName()); tErpSupplierWarehousing.setGoodsCount(inventoryGoodsDto.getInventoryCount() - inventoryGoodsDto.getNum()); @@ -206,7 +251,7 @@ TErpSupplierOutbound tErpSupplierOutbound = new TErpSupplierOutbound(); tErpSupplierOutbound.setWarehouseId(dto.getWarehouseId()); - tErpSupplierOutbound.setSupplierId(String.valueOf(user.getUserId())); + tErpSupplierOutbound.setSupplierId(supplierClinicId); tErpSupplierOutbound.setGoodsId(tErpSupplierWarehousing1.getGoodsId()); tErpSupplierOutbound.setOutboundType(6); tErpSupplierOutbound.setOutboundNumber("G" + s); -- Gitblit v1.7.1