From 770361cf5d70c7893ffea4f1dacac297628aea1d Mon Sep 17 00:00:00 2001
From: chenhj <1263187585@qq.com>
Date: 星期五, 20 六月 2025 18:03:00 +0800
Subject: [PATCH] Merge branch 'master' of http://114.132.189.42:9002/r/zd-after
---
main-business/src/main/java/com/ruoyi/business/service/impl/PendingInventoryServiceImpl.java | 1
basic-server/src/main/resources/db/migration/postgresql/V20250606171000__create_table_coal_value.sql | 2
main-business/src/main/java/com/ruoyi/business/service/impl/ProductionMasterServiceImpl.java | 248 ++++++++++++++++++----------------
pom.xml | 1
ruoyi-common/pom.xml | 6
main-business/src/main/resources/db/migration/postgresql/V20250604111200__create_table_official_inventory.sql | 8
main-business/src/main/java/com/ruoyi/business/service/impl/OfficialInventoryServiceImpl.java | 1
ruoyi-common/src/main/resources/db/migration/postgresql/V20250525003427__create_table_storage_blob.sql | 26 ++-
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java | 5
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java | 2
main-business/src/main/java/com/ruoyi/business/dto/PendingInventoryDto.java | 5
main-business/src/main/java/com/ruoyi/business/entity/ProductionInventory.java | 6
basic-server/src/main/resources/db/migration/postgresql/V20250606170900__create_table_coal_plan.sql | 2
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java | 32 ++--
main-business/src/main/java/com/ruoyi/business/entity/PendingInventory.java | 12 +
basic-server/src/main/resources/db/migration/postgresql/V20250606163300__create_table_coal_field.sql | 18 +-
main-business/src/main/java/com/ruoyi/business/entity/ProductionMaster.java | 5
main-business/src/main/java/com/ruoyi/business/service/impl/PurchaseRegistrationServiceImpl.java | 1
18 files changed, 199 insertions(+), 182 deletions(-)
diff --git a/basic-server/src/main/resources/db/migration/postgresql/V20250606163300__create_table_coal_field.sql b/basic-server/src/main/resources/db/migration/postgresql/V20250606163300__create_table_coal_field.sql
index 8e04bea..0380e56 100644
--- a/basic-server/src/main/resources/db/migration/postgresql/V20250606163300__create_table_coal_field.sql
+++ b/basic-server/src/main/resources/db/migration/postgresql/V20250606163300__create_table_coal_field.sql
@@ -1,16 +1,16 @@
-- 鍒涘缓鐓よ川淇℃伅琛�
CREATE TABLE coal_field
(
- id BIGSERIAL PRIMARY KEY, -- 涓婚敭ID锛岃嚜鍔ㄩ�掑
- fields VARCHAR(255) NOT NULL, --鐓よ川瀛楁
- field_name VARCHAR(255) NOT NULL, -- 鐓よ川鎻忚堪
- field_description VARCHAR(255) NOT NULL, -- 鐓よ川鎻忚堪
+ id BIGSERIAL PRIMARY KEY, -- 涓婚敭ID锛岃嚜鍔ㄩ�掑
+ fields VARCHAR(255) NOT NULL, --鐓よ川瀛楁
+ field_name VARCHAR(255) NOT NULL, -- 鐓よ川鎻忚堪
+ field_description VARCHAR(255), -- 鐓よ川鎻忚堪
- deleted INT NOT NULL DEFAULT 0, -- 杞垹闄ゆ爣蹇楋細0=鏈垹闄わ紝1=宸插垹闄�
- create_by VARCHAR(255), -- 鍒涘缓浜虹敤鎴峰悕
- create_time TIMESTAMP WITHOUT TIME ZONE, -- 鍒涘缓鏃堕棿锛岄粯璁ゅ綋鍓嶆椂闂�
- update_by VARCHAR(255), -- 鏈�鍚庢洿鏂颁汉鐢ㄦ埛鍚�
- update_time TIMESTAMP WITHOUT TIME ZONE -- 鏈�鍚庢洿鏂版椂闂达紝榛樿褰撳墠鏃堕棿
+ deleted INT NOT NULL DEFAULT 0, -- 杞垹闄ゆ爣蹇楋細0=鏈垹闄わ紝1=宸插垹闄�
+ create_by VARCHAR(255), -- 鍒涘缓浜虹敤鎴峰悕
+ create_time TIMESTAMP WITHOUT TIME ZONE, -- 鍒涘缓鏃堕棿锛岄粯璁ゅ綋鍓嶆椂闂�
+ update_by VARCHAR(255), -- 鏈�鍚庢洿鏂颁汉鐢ㄦ埛鍚�
+ update_time TIMESTAMP WITHOUT TIME ZONE -- 鏈�鍚庢洿鏂版椂闂达紝榛樿褰撳墠鏃堕棿
);
-- 琛ㄦ敞閲�
diff --git a/basic-server/src/main/resources/db/migration/postgresql/V20250606170900__create_table_coal_plan.sql b/basic-server/src/main/resources/db/migration/postgresql/V20250606170900__create_table_coal_plan.sql
index 2d4170c..ee0d714 100644
--- a/basic-server/src/main/resources/db/migration/postgresql/V20250606170900__create_table_coal_plan.sql
+++ b/basic-server/src/main/resources/db/migration/postgresql/V20250606170900__create_table_coal_plan.sql
@@ -4,7 +4,7 @@
id BIGSERIAL PRIMARY KEY, -- 涓婚敭ID锛岃嚜鍔ㄩ�掑
plan VARCHAR(255) NOT NULL, --鐓よ川鏂规
field_ids VARCHAR(255) NOT NULL, --鐓よ川鏂规瀛楁id
- coal_fields BIGINT NOT NULL, -- 鐓よ川鏂规瀛楁
+ coal_fields VARCHAR(255) NOT NULL, -- 鐓よ川鏂规瀛楁
scheme_desc VARCHAR(255), -- 瀛楁鎻忚堪
deleted INT NOT NULL DEFAULT 0, -- 杞垹闄ゆ爣蹇楋細0=鏈垹闄わ紝1=宸插垹闄�
diff --git a/basic-server/src/main/resources/db/migration/postgresql/V20250606171000__create_table_coal_value.sql b/basic-server/src/main/resources/db/migration/postgresql/V20250606171000__create_table_coal_value.sql
index 0079081..0ed3585 100644
--- a/basic-server/src/main/resources/db/migration/postgresql/V20250606171000__create_table_coal_value.sql
+++ b/basic-server/src/main/resources/db/migration/postgresql/V20250606171000__create_table_coal_value.sql
@@ -2,7 +2,7 @@
CREATE TABLE coal_value
(
id BIGSERIAL PRIMARY KEY, -- 涓婚敭ID锛岃嚜鍔ㄩ�掑
- plan_id VARCHAR(255) NOT NULL, --鍏宠仈鐓よ川鏂规涓婚敭ID
+ plan_id BIGINT NOT NULL, --鍏宠仈鐓よ川鏂规涓婚敭ID
coal_value VARCHAR(255) NOT NULL, -- 瀛楁鍊�
fields VARCHAR(255) NOT NULL, -- 瀛楁
field_name VARCHAR(255) NOT NULL, -- 瀛楁鍚�
diff --git a/main-business/src/main/java/com/ruoyi/business/dto/PendingInventoryDto.java b/main-business/src/main/java/com/ruoyi/business/dto/PendingInventoryDto.java
index 8836167..e26af63 100644
--- a/main-business/src/main/java/com/ruoyi/business/dto/PendingInventoryDto.java
+++ b/main-business/src/main/java/com/ruoyi/business/dto/PendingInventoryDto.java
@@ -33,4 +33,9 @@
* 瀛楁鍚�
*/
private String fieldName;
+
+ /**
+ * 瀛楁鍚�
+ */
+ private Integer type;
}
diff --git a/main-business/src/main/java/com/ruoyi/business/entity/PendingInventory.java b/main-business/src/main/java/com/ruoyi/business/entity/PendingInventory.java
index 07cea32..f4210cc 100644
--- a/main-business/src/main/java/com/ruoyi/business/entity/PendingInventory.java
+++ b/main-business/src/main/java/com/ruoyi/business/entity/PendingInventory.java
@@ -25,6 +25,13 @@
*/
@TableId(value = "id", type = IdType.AUTO)
private Long id;
+
+ /**
+ *
+ * 鐢熶骇鍔犲伐id
+ */
+ @TableField(value = "master_id")
+ private Long masterId;
/**
* 渚涜揣鍟嗗悕绉�
*/
@@ -35,11 +42,6 @@
*/
@TableField(value = "coal_id")
private Long coalId;
- /**
- * 鐓ょ
- */
- @TableField(value = "coal")
- private String coal;
/**
* 鍗曚綅
*/
diff --git a/main-business/src/main/java/com/ruoyi/business/entity/ProductionInventory.java b/main-business/src/main/java/com/ruoyi/business/entity/ProductionInventory.java
index 678c1ab..4e8633d 100644
--- a/main-business/src/main/java/com/ruoyi/business/entity/ProductionInventory.java
+++ b/main-business/src/main/java/com/ruoyi/business/entity/ProductionInventory.java
@@ -31,11 +31,7 @@
*/
@TableField(value = "coal_id")
private Long coalId;
- /**
- * 鐓ょ
- */
- @TableField(value = "coal")
- private String coal;
+
/**
* 搴撳瓨鏁伴噺
*/
diff --git a/main-business/src/main/java/com/ruoyi/business/entity/ProductionMaster.java b/main-business/src/main/java/com/ruoyi/business/entity/ProductionMaster.java
index d35f0f6..8925c3b 100644
--- a/main-business/src/main/java/com/ruoyi/business/entity/ProductionMaster.java
+++ b/main-business/src/main/java/com/ruoyi/business/entity/ProductionMaster.java
@@ -28,11 +28,6 @@
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
- * 鐓ょ
- */
- @TableField(value = "coal")
- private String coal;
- /**
* 鐓ょid
*/
@TableField(value = "coal_id")
diff --git a/main-business/src/main/java/com/ruoyi/business/service/impl/OfficialInventoryServiceImpl.java b/main-business/src/main/java/com/ruoyi/business/service/impl/OfficialInventoryServiceImpl.java
index bcd598d..ba427bd 100644
--- a/main-business/src/main/java/com/ruoyi/business/service/impl/OfficialInventoryServiceImpl.java
+++ b/main-business/src/main/java/com/ruoyi/business/service/impl/OfficialInventoryServiceImpl.java
@@ -155,6 +155,7 @@
// 2. 鎻掑叆鏂板簱瀛樿褰�
OfficialInventory officialInventory = new OfficialInventory();
BeanUtils.copyProperties(officialInventoryDto, officialInventory);
+ officialInventory.setId(null);
officialInventory.setMergeId(ids.toString());
officialInventory.setRegistrantId(SecurityUtils.getLoginUser().getUser().getUserName());
if (officialInventoryMapper.insert(officialInventory) <= 0) {
diff --git a/main-business/src/main/java/com/ruoyi/business/service/impl/PendingInventoryServiceImpl.java b/main-business/src/main/java/com/ruoyi/business/service/impl/PendingInventoryServiceImpl.java
index 53182f3..af85197 100644
--- a/main-business/src/main/java/com/ruoyi/business/service/impl/PendingInventoryServiceImpl.java
+++ b/main-business/src/main/java/com/ruoyi/business/service/impl/PendingInventoryServiceImpl.java
@@ -168,6 +168,7 @@
coalValue.setCoalValue(value);
coalValue.setFields(key);
coalValue.setFieldName(fieldName);
+ coalValue.setType(String.valueOf(1));
i = coalValueMapper.insert(coalValue);
}
}
diff --git a/main-business/src/main/java/com/ruoyi/business/service/impl/ProductionMasterServiceImpl.java b/main-business/src/main/java/com/ruoyi/business/service/impl/ProductionMasterServiceImpl.java
index ff10b10..a10f889 100644
--- a/main-business/src/main/java/com/ruoyi/business/service/impl/ProductionMasterServiceImpl.java
+++ b/main-business/src/main/java/com/ruoyi/business/service/impl/ProductionMasterServiceImpl.java
@@ -19,7 +19,6 @@
import java.math.BigDecimal;
import java.util.*;
-import java.util.function.Function;
import java.util.stream.Collectors;
/**
@@ -116,140 +115,157 @@
@Override
@Transactional
- public int addOrEditPM(ProductionMasterDto productionMasterDto) {
- // 1. 鐩存帴璁$畻鑱氬悎鍊硷紝閬垮厤鍒涘缓澶氫綑鍒楄〃
- BigDecimal totalPurchasePrice = BigDecimal.ZERO;
- BigDecimal totalLaborCost = BigDecimal.ZERO;
- BigDecimal totalEnergyConsumptionCost = BigDecimal.ZERO;
- BigDecimal totalTotalCost = BigDecimal.ZERO;
- BigDecimal totalEquipmentDepreciation = BigDecimal.ZERO;
- BigDecimal totalProductionQuantity = BigDecimal.ZERO;
+ public int addOrEditPM(ProductionMasterDto dto) {
+ Long masterId = dto.getId();
- for (Production production : productionMasterDto.getProductionList()) {
- totalPurchasePrice = totalPurchasePrice.add(production.getPurchasePrice());
- totalLaborCost = totalLaborCost.add(production.getLaborCost());
- totalEnergyConsumptionCost = totalEnergyConsumptionCost.add(production.getEnergyConsumptionCost());
- totalTotalCost = totalTotalCost.add(production.getTotalCost());
- totalEquipmentDepreciation = totalEquipmentDepreciation.add(production.getEquipmentDepreciation());
- totalProductionQuantity = production.getProductionQuantity().add(totalProductionQuantity);
+ // 缂栬緫鍦烘櫙锛氬洖婊氭棫搴撳瓨骞跺垹闄ゆ棫璁板綍
+ if (masterId != null) {
+ rollbackOldInventory(masterId);
+ deleteChildRecords(masterId);
}
- //鐓ょ瀛楁
- List<Long> coalIds = productionMasterDto.getProductionList().stream()
- .map(Production::getCoalId)
- .collect(Collectors.toList());
- List<CoalInfo> coalInfos = coalInfoMapper.selectList(new LambdaQueryWrapper<CoalInfo>().in(CoalInfo::getId, coalIds));
+ // 鏍¢獙浣跨敤閲忓苟鍑忓皯搴撳瓨
+ validateAndReduceInventory(dto.getProductionInventoryList());
- // 2. 鍒涘缓涓昏〃瀵硅薄
- ProductionMaster productionMaster = new ProductionMaster();
- productionMaster.setProductionQuantity(totalProductionQuantity);
- productionMaster.setTotalCost(totalTotalCost);
- productionMaster.setEquipmentDepreciation(totalEquipmentDepreciation);
- productionMaster.setEnergyConsumptionCost(totalEnergyConsumptionCost);
- productionMaster.setLaborCost(totalLaborCost);
- productionMaster.setCoal(coalInfos.stream().map(CoalInfo::getCoal).collect(Collectors.joining(",")));
- productionMaster.setCoalId(coalIds.stream().map(String::valueOf).collect(Collectors.joining(",")));
+ // 鏋勯�犱富琛ㄥ疄浣撳璞�
+ ProductionMaster master = buildProductionMaster(dto);
- Long masterId = productionMasterDto.getId();
- productionMaster.setId(masterId);
-
- // 3. 缁熶竴瀛愯〃澶勭悊閫昏緫
+ // 鎻掑叆鎴栨洿鏂颁富琛�
if (masterId == null) {
- productionMasterMapper.insert(productionMaster);
- masterId = productionMaster.getId(); // 鑾峰彇鏂扮敓鎴愮殑ID
+ productionMasterMapper.insert(master);
+ masterId = master.getId();
} else {
- // 鍒犻櫎鍏宠仈瀛愯〃鏁版嵁
- productionMapper.delete(new LambdaQueryWrapper<Production>()
- .eq(Production::getProductionMasterId, masterId));
-
- productionInventoryMapper.delete(new LambdaQueryWrapper<ProductionInventory>()
- .eq(ProductionInventory::getProductionMasterId, masterId));
-
- productionMasterMapper.updateById(productionMaster);
+ master.setId(masterId);
+ productionMasterMapper.updateById(master);
}
- //搴撳瓨鏇存柊
- for (ProductionInventory productionInventory : productionMasterDto.getProductionInventoryList()) {
- OfficialInventory officialInventory = officialInventoryMapper.selectById(productionInventory.getOfficialId());
- BigDecimal subtract = officialInventory.getInventoryQuantity().subtract(new BigDecimal(productionInventory.getUsedQuantity()));
- if (subtract.compareTo(BigDecimal.ZERO) < 0) {
- throw new BaseException("搴撳瓨涓嶈冻");
- }
- officialInventory.setInventoryQuantity(subtract);
- officialInventoryMapper.updateById(officialInventory);
- }
-
- // 4. 鎵归噺鎻掑叆瀛愯〃鏁版嵁
- batchInsertProductions(masterId, productionMasterDto.getProductionList());
- batchInsertInventories(masterId, productionMasterDto.getProductionInventoryList());
- //5. 鎻掑叆鍒板緟鍏ュ簱
- for (Production production : productionMasterDto.getProductionList()) {
- PendingInventory pendingInventory = new PendingInventory();
- pendingInventory.setCoalId(production.getCoalId());
- pendingInventory.setInventoryQuantity(production.getProductionQuantity());
- pendingInventory.setSupplierName("鐢熶骇鍔犲伐鍏ュ簱");
- pendingInventory.setTotalPriceIncludingTax(production.getTotalCost());
- pendingInventory.setPriceIncludingTax(production.getPurchasePrice());
- }
+ // 鎵归噺鎻掑叆鐢熶骇璁板綍涓庡簱瀛樿褰�
+ batchInsertProductions(masterId, dto.getProductionList());
+ batchInsertInventories(masterId, dto.getProductionInventoryList());
+
+ // 鎻掑叆寰呭叆搴撴暟鎹�
+ insertPendingInventory(dto.getProductionList());
+
return 1;
}
- // 鎵归噺鎻掑叆鐢熶骇鏁版嵁
- private void batchInsertProductions(Long masterId, List<Production> productions) {
- if (productions.isEmpty()) {
- return;
- }
- // 1. 鏀堕泦鎵�鏈夐渶瑕佹煡璇㈢殑coalId
- List<Long> coalIds = productions.stream()
- .map(Production::getCoalId)
- .filter(Objects::nonNull)
- .distinct()
- .collect(Collectors.toList());
+ /**
+ * 鍥炴粴鏃х殑搴撳瓨鏁版嵁锛堝皢搴撳瓨鏁伴噺杩樺師锛�
+ */
+ private void rollbackOldInventory(Long masterId) {
+ List<ProductionInventory> oldInventories = productionInventoryMapper.selectList(
+ new LambdaQueryWrapper<ProductionInventory>().eq(ProductionInventory::getProductionMasterId, masterId));
- // 2. 鎵归噺鏌ヨcoalInfo鏁版嵁
- Map<Long, CoalInfo> coalInfoMap = coalIds.isEmpty() ?
- Collections.emptyMap() :
- coalInfoMapper.selectList(new LambdaQueryWrapper<CoalInfo>().in(CoalInfo::getId, coalIds))
- .stream()
- .collect(Collectors.toMap(CoalInfo::getId, Function.identity()));
- if (coalInfoMap.isEmpty()){
- throw new BaseException("鐓ょ淇℃伅涓嶅瓨鍦�");
- }
-
- // 3. 鍑嗗鎵归噺鎻掑叆鏁版嵁
- List<Production> batchInsertList = productions.stream()
- .map(production -> {
- Production p = new Production(); // 鍒涘缓鏂板璞¢伩鍏嶅壇浣滅敤
- BeanUtils.copyProperties(production, p);
- // 澶嶅埗蹇呰瀛楁
- p.setProductionMasterId(masterId);
- p.setCoalId(production.getCoalId());
- return p;
- })
- .collect(Collectors.toList());
- if (!batchInsertList.isEmpty()) {
- for (Production production : batchInsertList) {
- production.setId(null);
- productionMapper.insert(production);
+ for (ProductionInventory oldInv : oldInventories) {
+ OfficialInventory inv = officialInventoryMapper.selectById(oldInv.getOfficialId());
+ if (inv != null) {
+ inv.setInventoryQuantity(inv.getInventoryQuantity().add(new BigDecimal(oldInv.getUsedQuantity())));
+ officialInventoryMapper.updateById(inv);
}
}
}
- // 鎵归噺鎻掑叆搴撳瓨鏁版嵁
- private void batchInsertInventories(Long masterId, List<ProductionInventory> inventories) {
- List<ProductionInventory> insertList = inventories.stream()
- .peek(inv -> {
- inv.setId(null);
- inv.setProductionMasterId(masterId);
- })
- .collect(Collectors.toList());
+ /**
+ * 鍒犻櫎鏃х殑瀛愯〃鏁版嵁鍙婂緟鍏ュ簱鏁版嵁
+ */
+ private void deleteChildRecords(Long masterId) {
+ productionMapper.delete(new LambdaQueryWrapper<Production>().eq(Production::getProductionMasterId, masterId));
+ productionInventoryMapper.delete(new LambdaQueryWrapper<ProductionInventory>().eq(ProductionInventory::getProductionMasterId, masterId));
+ pendingInventoryMapper.delete(new LambdaQueryWrapper<PendingInventory>().eq(PendingInventory::getMasterId, masterId));
+ }
- if (!insertList.isEmpty()) {
- for (ProductionInventory inventory : inventories) {
- inventory.setId(null);
- inventory.setProductionMasterId(masterId);
- productionInventoryMapper.insert(inventory);
+ /**
+ * 鏍¢獙姣忔潯浣跨敤閲忔槸鍚﹁冻澶燂紝骞跺噺灏戞寮忓簱瀛樻暟閲�
+ */
+ private void validateAndReduceInventory(List<ProductionInventory> inventoryList) {
+ for (ProductionInventory inv : inventoryList) {
+ OfficialInventory official = officialInventoryMapper.selectById(inv.getOfficialId());
+ BigDecimal used = new BigDecimal(inv.getUsedQuantity());
+ if (official.getInventoryQuantity().compareTo(used) < 0) {
+ throw new BaseException("搴撳瓨涓嶈冻");
}
+ official.setInventoryQuantity(official.getInventoryQuantity().subtract(used));
+ officialInventoryMapper.updateById(official);
+ }
+ }
+
+ /**
+ * 鏋勯�犱富琛ㄥ璞″苟鑱氬悎瀛楁鍊硷紙濡傛�绘垚鏈�佺叅绉嶇瓑锛�
+ */
+ private ProductionMaster buildProductionMaster(ProductionMasterDto dto) {
+ BigDecimal totalPurchase = BigDecimal.ZERO;
+ BigDecimal totalLabor = BigDecimal.ZERO;
+ BigDecimal totalEnergy = BigDecimal.ZERO;
+ BigDecimal totalCost = BigDecimal.ZERO;
+ BigDecimal totalDepreciation = BigDecimal.ZERO;
+ BigDecimal totalQuantity = BigDecimal.ZERO;
+
+ List<Long> coalIds = new ArrayList<>();
+
+ for (Production p : dto.getProductionList()) {
+ totalPurchase = totalPurchase.add(p.getPurchasePrice());
+ totalLabor = totalLabor.add(p.getLaborCost());
+ totalEnergy = totalEnergy.add(p.getEnergyConsumptionCost());
+ totalCost = totalCost.add(p.getTotalCost());
+ totalDepreciation = totalDepreciation.add(p.getEquipmentDepreciation());
+ totalQuantity = totalQuantity.add(p.getProductionQuantity());
+ coalIds.add(p.getCoalId());
+ }
+
+ List<CoalInfo> coalInfos = coalInfoMapper.selectList(new LambdaQueryWrapper<CoalInfo>().in(CoalInfo::getId, coalIds));
+
+ ProductionMaster master = new ProductionMaster();
+ master.setProductionQuantity(totalQuantity);
+ master.setTotalCost(totalCost);
+ master.setLaborCost(totalLabor);
+ master.setEnergyConsumptionCost(totalEnergy);
+ master.setEquipmentDepreciation(totalDepreciation);
+ master.setCoalId(coalIds.stream().map(String::valueOf).collect(Collectors.joining(",")));
+
+ return master;
+ }
+
+ /**
+ * 鎵归噺鎻掑叆鐢熶骇瀛愯〃鏁版嵁
+ */
+ private void batchInsertProductions(Long masterId, List<Production> list) {
+ if (list.isEmpty()) return;
+
+ for (Production p : list) {
+ Production copy = new Production();
+ BeanUtils.copyProperties(p, copy);
+ copy.setId(null);
+ copy.setProductionMasterId(masterId);
+ productionMapper.insert(copy);
+ }
+ }
+
+ /**
+ * 鎵归噺鎻掑叆搴撳瓨浣跨敤瀛愯〃鏁版嵁
+ */
+ private void batchInsertInventories(Long masterId, List<ProductionInventory> list) {
+ if (list.isEmpty()) return;
+
+ for (ProductionInventory p : list) {
+ p.setId(null);
+ p.setProductionMasterId(masterId);
+ productionInventoryMapper.insert(p);
+ }
+ }
+
+ /**
+ * 灏嗗姞宸ヤ骇鐢熺殑浜у搧璁板綍鍒板緟鍏ュ簱琛�
+ */
+ private void insertPendingInventory(List<Production> list) {
+ for (Production p : list) {
+ PendingInventory pending = new PendingInventory();
+ pending.setCoalId(p.getCoalId());
+ pending.setInventoryQuantity(p.getProductionQuantity());
+ pending.setSupplierName("鐢熶骇鍔犲伐鍏ュ簱");
+ pending.setTotalPriceIncludingTax(p.getTotalCost());
+ pending.setPriceIncludingTax(p.getPurchasePrice());
+ pending.setPriceIncludingTax(p.getPurchasePrice());
+ pendingInventoryMapper.insert(pending);
}
}
diff --git a/main-business/src/main/java/com/ruoyi/business/service/impl/PurchaseRegistrationServiceImpl.java b/main-business/src/main/java/com/ruoyi/business/service/impl/PurchaseRegistrationServiceImpl.java
index da11924..ed6177c 100644
--- a/main-business/src/main/java/com/ruoyi/business/service/impl/PurchaseRegistrationServiceImpl.java
+++ b/main-business/src/main/java/com/ruoyi/business/service/impl/PurchaseRegistrationServiceImpl.java
@@ -88,7 +88,6 @@
// 閲囪喘鐧昏鎴愬姛锛屽悓姝ュ垱寤哄緟鍏ュ簱璁板綍
PendingInventory pendingInventory = createPendingInventory(purchaseRegistration);
pendingInventory.setSupplierName(supply.getSupplierName());
- pendingInventory.setCoal(coalInfo.getCoal());
return pendingInventoryMapper.insert(pendingInventory);
}
return insertCount;
diff --git a/main-business/src/main/resources/db/migration/postgresql/V20250604111200__create_table_official_inventory.sql b/main-business/src/main/resources/db/migration/postgresql/V20250604111200__create_table_official_inventory.sql
index a8043a8..433afe9 100644
--- a/main-business/src/main/resources/db/migration/postgresql/V20250604111200__create_table_official_inventory.sql
+++ b/main-business/src/main/resources/db/migration/postgresql/V20250604111200__create_table_official_inventory.sql
@@ -5,16 +5,16 @@
supplier_name VARCHAR(255) NOT NULL, -- 渚涜揣鍟嗗悕绉�
coal VARCHAR(50) NOT NULL, -- 鐓ょ
unit VARCHAR(50) NOT NULL, -- 鍗曚綅
- inventory_quantity DECIMAL(10, 2) NOT NULL, -- 搴撳瓨鏁伴噺
+ inventory_quantity DECIMAL(10, 0), -- 搴撳瓨鏁伴噺
price_including_tax DECIMAL(10, 2) NOT NULL, -- 鍗曚环锛堝惈绋庯級
total_price_including_tax DECIMAL(10, 2) NOT NULL, -- 鎬讳环锛堝惈绋庯級
price_excluding_tax DECIMAL(10, 2) NOT NULL, -- 涓嶅惈绋庡崟浠�
total_price_excluding_tax DECIMAL(10, 2) NOT NULL, -- 涓嶅惈绋庢�讳环
- pending_replenishment DECIMAL(10, 2) NOT NULL, -- 寰呰ˉ搴�
+ pending_replenishment DECIMAL(10, 0), -- 寰呰ˉ搴�
registrant_id VARCHAR(50) NOT NULL, -- 鐧昏浜篿d
- type VARCHAR(50) NOT NULL, -- 鐧昏浜篿d
+ type VARCHAR(50), -- 绫诲瀷 1 閲囪喘/ 2 姝e紡 鍏ュ簱
pending_id BIGINT, -- 寰呭叆搴搃d
- merge_id BIGINT, -- 鍚堝苟id
+ merge_id VARCHAR(255), -- 鍚堝苟id
registration_date TIMESTAMP WITHOUT TIME ZONE,
deleted INT NOT NULL DEFAULT 0, -- 杞垹闄ゆ爣蹇楋細0=鏈垹闄わ紝1=宸插垹闄�
diff --git a/pom.xml b/pom.xml
index da9aa5f..de2ebda 100644
--- a/pom.xml
+++ b/pom.xml
@@ -18,7 +18,6 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>17</java.version>
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
- <mybatis-spring-boot.version>3.0.3</mybatis-spring-boot.version>
<druid.version>1.2.23</druid.version>
<bitwalker.version>1.21</bitwalker.version>
<swagger.version>3.0.0</swagger.version>
diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml
index ffa3d11..1ce8076 100644
--- a/ruoyi-common/pom.xml
+++ b/ruoyi-common/pom.xml
@@ -119,12 +119,6 @@
<artifactId>jakarta.servlet-api</artifactId>
</dependency>
- <dependency>
- <groupId>org.mybatis</groupId>
- <artifactId>mybatis</artifactId>
- <version>3.5.16</version>
- </dependency>
-
<!-- minio -->
<dependency>
<groupId>io.minio</groupId>
diff --git a/ruoyi-common/src/main/resources/db/migration/postgresql/V20250525003427__create_table_storage_blob.sql b/ruoyi-common/src/main/resources/db/migration/postgresql/V20250525003427__create_table_storage_blob.sql
index d1ad350..223074b 100644
--- a/ruoyi-common/src/main/resources/db/migration/postgresql/V20250525003427__create_table_storage_blob.sql
+++ b/ruoyi-common/src/main/resources/db/migration/postgresql/V20250525003427__create_table_storage_blob.sql
@@ -3,22 +3,32 @@
CREATE TABLE storage_blob
(
id bigserial PRIMARY KEY,
- create_time timestamp default now() NOT NULL,
+ create_time timestamp default now() NOT NULL,
key varchar(150) DEFAULT '' NOT NULL,
content_type varchar(100) DEFAULT '' NOT NULL,
original_filename varchar(255) DEFAULT '' NOT NULL,
bucket_filename varchar(255) DEFAULT '' NOT NULL,
bucket_name varchar(255) DEFAULT '' NOT NULL,
byte_size bigint DEFAULT 0 NOT NULL,
+ type varchar(150),
UNIQUE (key)
);
-COMMENT ON TABLE storage_blob IS '閫氱敤鏂囦欢涓婁紶鐨勯檮浠朵俊鎭�';
+COMMENT
+ON TABLE storage_blob IS '閫氱敤鏂囦欢涓婁紶鐨勯檮浠朵俊鎭�';
-COMMENT ON COLUMN storage_blob.key IS '璧勬簮id';
-COMMENT ON COLUMN storage_blob.content_type IS '璧勬簮绫诲瀷锛屼緥濡侸PG鍥剧墖鐨勮祫婧愮被鍨嬩负image/jpg';
-COMMENT ON COLUMN storage_blob.original_filename IS '鍘熸枃浠跺悕绉�';
-COMMENT ON COLUMN storage_blob.bucket_filename IS '瀛樺偍妗朵腑鏂囦欢鍚�';
-COMMENT ON COLUMN storage_blob.bucket_name IS '瀛樺偍妗跺悕';
-COMMENT ON COLUMN storage_blob.byte_size IS '璧勬簮灏哄(瀛楄妭)';
+COMMENT
+ON COLUMN storage_blob.key IS '璧勬簮id';
+COMMENT
+ON COLUMN storage_blob.content_type IS '璧勬簮绫诲瀷锛屼緥濡侸PG鍥剧墖鐨勮祫婧愮被鍨嬩负image/jpg';
+COMMENT
+ON COLUMN storage_blob.original_filename IS '鍘熸枃浠跺悕绉�';
+COMMENT
+ON COLUMN storage_blob.bucket_filename IS '瀛樺偍妗朵腑鏂囦欢鍚�';
+COMMENT
+ON COLUMN storage_blob.bucket_name IS '瀛樺偍妗跺悕';
+COMMENT
+ON COLUMN storage_blob.byte_size IS '璧勬簮灏哄(瀛楄妭)';
+COMMENT
+ON COLUMN storage_blob.type IS '0鐢熶骇鍓� 1鐢熶骇鍚� 2鐢熶骇闂';
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java
index f0d3ea4..6ba16c8 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java
@@ -8,7 +8,6 @@
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.exception.user.*;
-import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.MessageUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.ip.IpUtils;
@@ -170,8 +169,8 @@
{
SysUser sysUser = new SysUser();
sysUser.setUserId(userId);
- sysUser.setLoginIp(IpUtils.getIpAddr());
- sysUser.setLoginDate(DateUtils.getNowDate());
+// sysUser.setLoginIp(IpUtils.getIpAddr());
+// sysUser.setLoginDate(DateUtils.getNowDate());
userService.updateUserProfile(sysUser);
}
}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java
index 5ec84d4..72d0c91 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java
@@ -1,6 +1,5 @@
package com.ruoyi.system.mapper;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.common.core.domain.entity.SysUser;
import org.apache.ibatis.annotations.Param;
@@ -8,14 +7,13 @@
/**
* 鐢ㄦ埛琛� 鏁版嵁灞�
- *
+ *
* @author ruoyi
*/
-public interface SysUserMapper
-extends BaseMapper<SysUser> {
+public interface SysUserMapper{
/**
* 鏍规嵁鏉′欢鍒嗛〉鏌ヨ鐢ㄦ埛鍒楄〃
- *
+ *
* @param sysUser 鐢ㄦ埛淇℃伅
* @return 鐢ㄦ埛淇℃伅闆嗗悎淇℃伅
*/
@@ -23,7 +21,7 @@
/**
* 鏍规嵁鏉′欢鍒嗛〉鏌ヨ宸查厤鐢ㄦ埛瑙掕壊鍒楄〃
- *
+ *
* @param user 鐢ㄦ埛淇℃伅
* @return 鐢ㄦ埛淇℃伅闆嗗悎淇℃伅
*/
@@ -31,7 +29,7 @@
/**
* 鏍规嵁鏉′欢鍒嗛〉鏌ヨ鏈垎閰嶇敤鎴疯鑹插垪琛�
- *
+ *
* @param user 鐢ㄦ埛淇℃伅
* @return 鐢ㄦ埛淇℃伅闆嗗悎淇℃伅
*/
@@ -39,7 +37,7 @@
/**
* 閫氳繃鐢ㄦ埛鍚嶆煡璇㈢敤鎴�
- *
+ *
* @param userName 鐢ㄦ埛鍚�
* @return 鐢ㄦ埛瀵硅薄淇℃伅
*/
@@ -47,7 +45,7 @@
/**
* 閫氳繃鐢ㄦ埛ID鏌ヨ鐢ㄦ埛
- *
+ *
* @param userId 鐢ㄦ埛ID
* @return 鐢ㄦ埛瀵硅薄淇℃伅
*/
@@ -55,7 +53,7 @@
/**
* 鏂板鐢ㄦ埛淇℃伅
- *
+ *
* @param user 鐢ㄦ埛淇℃伅
* @return 缁撴灉
*/
@@ -63,7 +61,7 @@
/**
* 淇敼鐢ㄦ埛淇℃伅
- *
+ *
* @param user 鐢ㄦ埛淇℃伅
* @return 缁撴灉
*/
@@ -71,16 +69,16 @@
/**
* 淇敼鐢ㄦ埛澶村儚
- *
+ *
* @param userName 鐢ㄦ埛鍚�
- * @param avatar 澶村儚鍦板潃
+ * @param avatar 澶村儚鍦板潃
* @return 缁撴灉
*/
public int updateUserAvatar(@Param("userName") String userName, @Param("avatar") String avatar);
/**
* 閲嶇疆鐢ㄦ埛瀵嗙爜
- *
+ *
* @param userName 鐢ㄦ埛鍚�
* @param password 瀵嗙爜
* @return 缁撴灉
@@ -89,7 +87,7 @@
/**
* 閫氳繃鐢ㄦ埛ID鍒犻櫎鐢ㄦ埛
- *
+ *
* @param userId 鐢ㄦ埛ID
* @return 缁撴灉
*/
@@ -97,7 +95,7 @@
/**
* 鎵归噺鍒犻櫎鐢ㄦ埛淇℃伅
- *
+ *
* @param userIds 闇�瑕佸垹闄ょ殑鐢ㄦ埛ID
* @return 缁撴灉
*/
@@ -105,7 +103,7 @@
/**
* 鏍¢獙鐢ㄦ埛鍚嶇О鏄惁鍞竴
- *
+ *
* @param userName 鐢ㄦ埛鍚嶇О
* @return 缁撴灉
*/
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
index 73d946c..4390a34 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
@@ -302,6 +302,8 @@
@Override
public int updateUserProfile(SysUser user) {
return userMapper.updateUser(user);
+
+// return userMapper.update(user,new LambdaQueryWrapper<SysUser>().eq(SysUser::getUserId, user.getUserId()));
}
/**
--
Gitblit v1.9.3