From 49dd9ee3dea22203cd1a0cc53745cffb6607122c Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期三, 15 十月 2025 18:28:51 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TErpGoodsMapper.java | 5 +
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpSupplierWarehousingServiceImpl.java | 31 ++++---
ruoyi-system/src/main/java/com/ruoyi/system/query/PageAddListQuery.java | 17 ++++
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpProcurementServiceImpl.java | 26 +++---
ruoyi-system/src/main/resources/mapper/system/TErpGoodsMapper.xml | 70 +++++++++++++++++
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpGoodsServiceImpl.java | 12 +-
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpGoodsController.java | 17 +---
ruoyi-system/src/main/java/com/ruoyi/system/service/TErpGoodsService.java | 7 -
ruoyi-system/src/main/resources/mapper/system/TErpSupplierWarehousingMapper.xml | 11 ++
9 files changed, 145 insertions(+), 51 deletions(-)
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpGoodsController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpGoodsController.java
index 3d3cd00..b5250c4 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpGoodsController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpGoodsController.java
@@ -22,6 +22,7 @@
import com.ruoyi.system.dto.*;
import com.ruoyi.system.importExcel.TErpGoodsExcel;
import com.ruoyi.system.model.*;
+import com.ruoyi.system.query.PageAddListQuery;
import com.ruoyi.system.query.TErpGoodsAdminQuery;
import com.ruoyi.system.query.TErpGoodsQuery;
import com.ruoyi.system.service.*;
@@ -140,7 +141,7 @@
*/
@ApiOperation(value = "诊所 一键获取商品分页列表")
@PostMapping(value = "/pageAddList")
- public R<Page<TErpGoods>> pageAddList(@RequestBody BasePage query) {
+ public R<Page<TErpGoods>> pageAddList(@RequestBody PageAddListQuery query) {
SysUser user = tokenService.getLoginUser().getUser();
Integer roleType = user.getRoleType();
String clinicSupplierId=null;
@@ -153,17 +154,9 @@
}
Page<TErpGoods> tErpGoodsPage = new Page<>(query.getPageNum(), query.getPageSize());
- Page<TErpGoods> page = erpGoodsService.page(tErpGoodsPage, new LambdaQueryWrapper<TErpGoods>().eq(TErpGoods::getGoodsSource, 1).eq(TErpGoods::getState,1).eq(BaseModel::getDisabled, 0).isNotNull(TErpGoods::getPlatformCommissionPrice).last("and (NOT FIND_IN_SET(" + clinicSupplierId + ",clinic_ids) or clinic_ids is null)"));
- for (TErpGoods record : page.getRecords()) {
- TCrmSupplier byId = crmSupplierService.getById(record.getSupplierClinicId());
- record.setSupplierName(byId.getSupplierName());
-
-
- TErpGoodsType byId1 = erpGoodsTypeService.getById(record.getTypeId());
- record.setTypeName(byId1.getTypeName());
-
- }
- return R.ok(page);
+ List<TErpGoods> page = erpGoodsService.pageAddList(tErpGoodsPage,clinicSupplierId,query);
+ tErpGoodsPage.setRecords(page);
+ return R.ok(tErpGoodsPage);
}
/**
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TErpGoodsMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TErpGoodsMapper.java
index 7c66537..d3b8447 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TErpGoodsMapper.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TErpGoodsMapper.java
@@ -1,9 +1,11 @@
package com.ruoyi.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.basic.PageInfo;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.system.model.TErpGoods;
+import com.ruoyi.system.query.PageAddListQuery;
import com.ruoyi.system.query.TErpGoodsAdminQuery;
import com.ruoyi.system.query.TErpGoodsInventoryQuery;
import com.ruoyi.system.query.TErpGoodsQuery;
@@ -42,4 +44,7 @@
List<TErpGoodsVO> pageAdminList(@Param("query") TErpGoodsAdminQuery query, @Param("pageInfo") PageInfo<TErpGoodsVO> pageInfo);
+
+ List<TErpGoods> pageAddList(@Param("tErpGoodsPage") Page<TErpGoods> tErpGoodsPage, @Param("clinicSupplierId") String clinicSupplierId, @Param("query") PageAddListQuery query);
+
}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/query/PageAddListQuery.java b/ruoyi-system/src/main/java/com/ruoyi/system/query/PageAddListQuery.java
new file mode 100644
index 0000000..57e8b07
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/query/PageAddListQuery.java
@@ -0,0 +1,17 @@
+package com.ruoyi.system.query;
+
+import com.ruoyi.common.core.domain.BasePage;
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+@Data
+@ApiModel("一键获取商品分页列表 Query")
+public class PageAddListQuery extends BasePage {
+ private String goodsName;
+
+ private String supplierName;
+
+ private String typeId;
+
+ private String quasiNumber;
+}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/TErpGoodsService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/TErpGoodsService.java
index 69a61ff..95b7319 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/TErpGoodsService.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/TErpGoodsService.java
@@ -7,10 +7,7 @@
import com.ruoyi.system.dto.InventoryDto;
import com.ruoyi.system.dto.InventoryGoodsDto;
import com.ruoyi.system.model.TErpGoods;
-import com.ruoyi.system.query.TClinicGoodsWarehouseQuery;
-import com.ruoyi.system.query.TErpGoodsAdminQuery;
-import com.ruoyi.system.query.TErpGoodsInventoryQuery;
-import com.ruoyi.system.query.TErpGoodsQuery;
+import com.ruoyi.system.query.*;
import com.ruoyi.system.vo.OutboundGoodsDetailVo;
import com.ruoyi.system.vo.TErpGoodsInventoryVO;
import com.ruoyi.system.vo.TErpGoodsVO;
@@ -79,4 +76,6 @@
PageInfo<TErpGoodsVO> pageAdminList(TErpGoodsAdminQuery query);
+ List<TErpGoods> pageAddList(Page<TErpGoods> tErpGoodsPage, String clinicSupplierId, PageAddListQuery query);
+
}
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 7c2997f..4da89fe 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
@@ -13,10 +13,7 @@
import com.ruoyi.system.dto.InventoryGoodsDto;
import com.ruoyi.system.mapper.*;
import com.ruoyi.system.model.*;
-import com.ruoyi.system.query.TClinicGoodsWarehouseQuery;
-import com.ruoyi.system.query.TErpGoodsAdminQuery;
-import com.ruoyi.system.query.TErpGoodsInventoryQuery;
-import com.ruoyi.system.query.TErpGoodsQuery;
+import com.ruoyi.system.query.*;
import com.ruoyi.system.service.TErpGoodsService;
import com.ruoyi.system.service.TErpSupplierInventoryGoodsService;
import com.ruoyi.system.vo.*;
@@ -153,6 +150,11 @@
}
@Override
+ public List<TErpGoods> pageAddList(Page<TErpGoods> tErpGoodsPage, String clinicSupplierId, PageAddListQuery query) {
+ return this.baseMapper.pageAddList(tErpGoodsPage, clinicSupplierId, query);
+ }
+
+ @Override
public List<TErpGoodsVO> listExport(TErpGoodsQuery query, SysUser user) {
List<TErpGoodsVO> list = this.baseMapper.listExport(query, user);
if (list.isEmpty()) {
@@ -185,7 +187,7 @@
@Override
public boolean isExit(String goodsIdCode, String quasiNumber,String id) {
- Long size = this.baseMapper.selectCount(new LambdaQueryWrapper<>(TErpGoods.class).ne(id!=null,TErpGoods::getId, id).and(q -> q.eq(TErpGoods::getGoodsIdCode, goodsIdCode).or().eq(TErpGoods::getQuasiNumber, quasiNumber)));
+ Long size = this.baseMapper.selectCount(new LambdaQueryWrapper<>(TErpGoods.class).eq(TErpGoods::getGoodsSource,1).ne(id!=null,TErpGoods::getId, id).and(q -> q.eq(TErpGoods::getGoodsIdCode, goodsIdCode).or().eq(TErpGoods::getQuasiNumber, quasiNumber)));
if (size > 0) {
return true;
}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpProcurementServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpProcurementServiceImpl.java
index 9a1c86f..01d0b6d 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpProcurementServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpProcurementServiceImpl.java
@@ -149,25 +149,25 @@
List<String> ids = list.stream().map(TErpProcurementVo::getId).collect(Collectors.toList());
List<TErpProcurementGoods> tErpProcurementGoods = erpProcurementGoodsMapper.selectList
(new LambdaQueryWrapper<TErpProcurementGoods>().in(TErpProcurementGoods::getProcurementId, ids));
- List<TSysCommission> tSysCommissions = new ArrayList<>();
- if (!tErpProcurementGoods.isEmpty()) {
- List<String> collect = tErpProcurementGoods.stream().map(TErpProcurementGoods::getId).collect(Collectors.toList());
- tSysCommissions = sysCommissionMapper.selectList(new LambdaQueryWrapper<TSysCommission>().in(TSysCommission::getTErpProcurementGoodsId, collect));
- }
+//// List<TSysCommission> tSysCommissions = new ArrayList<>();
+// if (!tErpProcurementGoods.isEmpty()) {
+//// List<String> collect = tErpProcurementGoods.stream().map(TErpProcurementGoods::getId).collect(Collectors.toList());
+//// tSysCommissions = sysCommissionMapper.selectList(new LambdaQueryWrapper<TSysCommission>().in(TSysCommission::getTErpProcurementGoodsId, collect));
+// }
for (TErpProcurementVo tErpProcurementVo : list) {
List<TErpProcurementGoods> collect = tErpProcurementGoods.stream().filter(e -> e.getProcurementId().equals(tErpProcurementVo.getId())).collect(Collectors.toList());
int size = collect.stream().map(TErpProcurementGoods::getGoodsId).collect(Collectors.toSet()).size();
tErpProcurementVo.setTypeNum(size);
BigDecimal reduce = collect.stream().map(TErpProcurementGoods::getTotalPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
tErpProcurementVo.setTotalPrice(reduce);
- if (!collect.isEmpty()) {
- List<String> collect1 = collect.stream().map(TErpProcurementGoods::getId).collect(Collectors.toList());
- List<TSysCommission> collect2 = tSysCommissions.stream().filter(e -> collect1.contains(e.getTErpProcurementGoodsId())).collect(Collectors.toList());
- BigDecimal reduce1 = collect2.stream().filter(e -> e.getType() == 1).map(TSysCommission::getMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
- BigDecimal reduce2 = collect2.stream().filter(e -> e.getType() == 2).map(TSysCommission::getMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
- tErpProcurementVo.setPlatformMoney(reduce1);
- tErpProcurementVo.setSupplierMoney(reduce2);
- }
+// if (!collect.isEmpty()) {
+//// List<String> collect1 = collect.stream().map(TErpProcurementGoods::getId).collect(Collectors.toList());
+//// List<TSysCommission> collect2 = tSysCommissions.stream().filter(e -> collect1.contains(e.getTErpProcurementGoodsId())).collect(Collectors.toList());
+//// BigDecimal reduce1 = collect2.stream().filter(e -> e.getType() == 1).map(TSysCommission::getMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
+//// BigDecimal reduce2 = collect2.stream().filter(e -> e.getType() == 2).map(TSysCommission::getMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
+//// tErpProcurementVo.setPlatformMoney(reduce1);
+//// tErpProcurementVo.setSupplierMoney(reduce2);
+// }
}
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 1ee8e03..8754c39 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
@@ -554,22 +554,25 @@
tErpSupplierOutboundGoods1.setTotalPrice(multiply);
arrayList.add(tErpSupplierOutboundGoods1);
add = add.add(multiply);
+
+ TErpSupplierOutbound tErpSupplierOutbound = new TErpSupplierOutbound();
+ tErpSupplierOutbound.setOutboundType(dto.getOutboundType());
+ tErpSupplierOutbound.setOutboundReason(dto.getOutboundReason());
+ tErpSupplierOutbound.setWarehouseId(dto.getWarehouseId());
+ tErpSupplierOutbound.setSupplierId(supplierClinicId);
+ tErpSupplierOutbound.setTotalMoney(add);
+ String s = DateUtils.dateTimeNow();
+ tErpSupplierOutbound.setOutboundNumber("G" + s);
+ tErpSupplierOutbound.setGoodsId(tErpSupplierWarehousing.getGoodsId());
+ erpSupplierOutboundMapper.insert(tErpSupplierOutbound);
+
+ for (TErpSupplierOutboundGoods tErpSupplierOutboundGoods2 : arrayList) {
+ tErpSupplierOutboundGoods2.setOutboundId(tErpSupplierOutbound.getId());
+ erpSupplierOutboundGoodsMapper.insert(tErpSupplierOutboundGoods2);
+ }
+
}
- TErpSupplierOutbound tErpSupplierOutbound = new TErpSupplierOutbound();
- tErpSupplierOutbound.setOutboundType(dto.getOutboundType());
- tErpSupplierOutbound.setOutboundReason(dto.getOutboundReason());
- tErpSupplierOutbound.setWarehouseId(dto.getWarehouseId());
- tErpSupplierOutbound.setSupplierId(supplierClinicId);
- tErpSupplierOutbound.setTotalMoney(add);
- String s = DateUtils.dateTimeNow();
- tErpSupplierOutbound.setOutboundNumber("G" + s);
- erpSupplierOutboundMapper.insert(tErpSupplierOutbound);
-
- for (TErpSupplierOutboundGoods tErpSupplierOutboundGoods : arrayList) {
- tErpSupplierOutboundGoods.setOutboundId(tErpSupplierOutbound.getId());
- erpSupplierOutboundGoodsMapper.insert(tErpSupplierOutboundGoods);
- }
}
diff --git a/ruoyi-system/src/main/resources/mapper/system/TErpGoodsMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TErpGoodsMapper.xml
index 7984714..156886d 100644
--- a/ruoyi-system/src/main/resources/mapper/system/TErpGoodsMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/TErpGoodsMapper.xml
@@ -351,5 +351,75 @@
</if>
order by t1.create_time desc
</select>
+ <select id="pageAddList" resultType="com.ruoyi.system.model.TErpGoods">
+ SELECT t1.id,
+ t1.supplier_clinic_id,
+ t1.goods_source,
+ t1.goods_name,
+ t1.goods_id_code,
+ t1.quasi_number,
+ t1.manufacturer,
+ t1.formulation_spec,
+ t1.packing_spec,
+ t1.clinic_purchase_price,
+ t1.warning_inventory,
+ t1.type_id,
+ t1.goods_yards,
+ t1.maintenance_interval,
+ t1.maintenance_interval_unit,
+ t1.low_purchase_quantity,
+ t1.low_unit_id,
+ t1.is_prescription_drug,
+ t1.goods_spec,
+ t1.sales_amount,
+ t1.packing_unit_id,
+ t1.instructions_use,
+ t1.side_effect,
+ t1.platform_commission_price,
+ t1.state,
+ t1.simplified_code,
+ t1.dosage_form,
+ t1.usage_classification,
+ t1.product_brand,
+ t1.place_of_origin,
+ t1.ingredient,
+ t1.trait,
+ t1.indication,
+ t1.taboo,
+ t1.precautions,
+ t1.interaction,
+ t1.storage,
+ t1.barcode,
+ t2.supplier_name,
+ t1.clinic_ids,
+ t1.create_by,
+ t1.update_by,
+ t1.`disabled`,
+ t1.create_time,
+ t1.update_time,
+ t1.create_id,
+ t3.type_name
+ FROM t_erp_goods t1
+ LEFT JOIN t_crm_supplier t2 ON t1.supplier_clinic_id = t2.id
+ left join t_erp_goods_type t3 on t1.type_id = t3.id
+ WHERE t1.`disabled` = 0
+ AND (t1.goods_source = 1 AND t1.state = 1 AND t1.`disabled` = 0 AND t1.platform_commission_price IS NOT NULL)
+ and (NOT FIND_IN_SET(#{clinicSupplierId}, t1.clinic_ids) or t1.clinic_ids is null)
+ <if test="query.goodsName != null and query.goodsName != ''">
+ and t1.goods_name like concat('%',#{query.goodsName},'%')
+ </if>
+ <if test="query.typeId != null and query.typeId != ''">
+ and t1.type_id = #{query.typeId}
+ </if>
+ <if test="query.quasiNumber != null and query.quasiNumber != ''">
+ and t1.quasi_number like concat('%',#{query.quasiNumber},'%')
+ </if>
+ <if test="query.quasiNumber != null and query.quasiNumber != ''">
+ and t2.supplier_name like concat('%',#{query.supplierName},'%')
+ </if>
+ order by t1.create_time desc
+
+
+ </select>
</mapper>
diff --git a/ruoyi-system/src/main/resources/mapper/system/TErpSupplierWarehousingMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TErpSupplierWarehousingMapper.xml
index 87eebc7..52570a2 100644
--- a/ruoyi-system/src/main/resources/mapper/system/TErpSupplierWarehousingMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/TErpSupplierWarehousingMapper.xml
@@ -34,8 +34,13 @@
SUM(t2.unit_amount * (t2.goods_count - COALESCE(t3.outbound_count, 0))) as allTotalPrice,
COALESCE(sum(t3.outbound_count), 0) as outNum
- from t_erp_goods t1 left join t_erp_supplier_warehousing t2 on t1.id = t2.goods_id
- left join t_erp_supplier_outbound_goods t3 on t2.id = t3.warehousing_id
+ from t_erp_goods t1
+ left join t_erp_supplier_warehousing t2 on t1.id = t2.goods_id
+ left join (
+ select warehousing_id, sum(outbound_count) as outbound_count
+ from t_erp_supplier_outbound_goods
+ group by warehousing_id
+ ) t3 on t2.id = t3.warehousing_id
where t1.disabled = 0 and t2.id is not null
<if test="query.goodsName != null and query.goodsName != ''">
and t1.goods_name like concat('%',#{query.goodsName},'%')
@@ -124,7 +129,7 @@
<if test="user.roleType !=null and user.roleType ==4"> and t2.supplier_id =#{supplierClinicId}
</if>
<if test="query.name != null and query.name != ''">
- and t4.goods_name like concat('%',#{query.goodsName},'%')
+ and t4.goods_name like concat('%',#{query.name},'%')
</if>
<if test="query.quasiNumber != null and query.quasiNumber != ''">
and t4.quasi_number like concat('%',#{query.quasiNumber},'%')
--
Gitblit v1.7.1