From f904274947d9a4bb44037e4d18a7d85c6aadaf7b Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期六, 14 六月 2025 15:08:37 +0800
Subject: [PATCH] 1.生产加工 2.库存优化
---
main-business/src/main/java/com/ruoyi/business/controller/PendingInventoryController.java | 5
main-business/src/main/java/com/ruoyi/business/entity/InspectionTask.java | 59 +++
main-business/src/main/java/com/ruoyi/business/service/InspectionTaskService.java | 16
main-business/src/main/resources/db/migration/postgresql/V20250613112800__create_table_production_inventory.sql | 34 +
main-business/src/main/java/com/ruoyi/business/service/impl/InspectionTaskServiceImpl.java | 22 +
main-business/src/main/java/com/ruoyi/business/dto/ProductionMasterDto.java | 17
main-business/src/main/java/com/ruoyi/business/service/PendingInventoryService.java | 2
main-business/src/main/java/com/ruoyi/business/controller/ProductionController.java | 2
main-business/src/main/java/com/ruoyi/business/mapper/ProductionMasterMapper.java | 18 +
main-business/src/main/java/com/ruoyi/business/controller/ProductionMasterController.java | 54 +++
main-business/src/main/resources/mapper/ProductionMasterMapper.xml | 34 +
ruoyi-admin/src/main/java/com/ruoyi/PlusCodeGenerator.java | 11
main-business/src/main/java/com/ruoyi/business/entity/ProductionMaster.java | 75 ++++
main-business/src/main/resources/db/migration/postgresql/V20250604101800__create_table_production.sql | 36 +-
main-business/src/main/java/com/ruoyi/business/mapper/ProductionInventoryMapper.java | 18 +
main-business/src/main/java/com/ruoyi/business/controller/ProductionInventoryController.java | 39 ++
main-business/src/main/java/com/ruoyi/business/service/impl/ProductionInventoryServiceImpl.java | 33 +
main-business/src/main/resources/db/migration/postgresql/V20250614134700__create_table_inspection_task.sql | 34 +
main-business/src/main/java/com/ruoyi/business/service/impl/PendingInventoryServiceImpl.java | 75 +++
main-business/src/main/java/com/ruoyi/business/controller/InspectionTaskController.java | 21 +
main-business/src/main/java/com/ruoyi/business/dto/InspectionTaskDto.java | 8
main-business/src/main/java/com/ruoyi/business/service/ProductionInventoryService.java | 19 +
main-business/src/main/resources/mapper/ProductionInventoryMapper.xml | 30 +
main-business/src/main/java/com/ruoyi/business/service/impl/ProductionMasterServiceImpl.java | 215 +++++++++++
ruoyi-admin/src/main/resources/templates/controller.Java.ftl | 2
main-business/src/main/java/com/ruoyi/business/dto/PendingInventoryDto.java | 6
main-business/src/main/java/com/ruoyi/business/entity/ProductionInventory.java | 49 ++
main-business/src/main/java/com/ruoyi/business/service/ProductionMasterService.java | 24 +
main-business/src/main/resources/db/migration/postgresql/V20250613093400__create_table_production_master.sql | 40 ++
main-business/src/main/resources/mapper/InspectionTaskMapper.xml | 32 +
main-business/src/main/java/com/ruoyi/business/entity/Production.java | 15
main-business/src/main/java/com/ruoyi/business/mapper/InspectionTaskMapper.java | 18 +
32 files changed, 1,016 insertions(+), 47 deletions(-)
diff --git a/main-business/src/main/java/com/ruoyi/business/controller/InspectionTaskController.java b/main-business/src/main/java/com/ruoyi/business/controller/InspectionTaskController.java
new file mode 100644
index 0000000..60d0985
--- /dev/null
+++ b/main-business/src/main/java/com/ruoyi/business/controller/InspectionTaskController.java
@@ -0,0 +1,21 @@
+package com.ruoyi.business.controller;
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import lombok.AllArgsConstructor;
+ import org.springframework.web.bind.annotation.RestController;
+
+/**
+* <p>
+ * 宸℃浠诲姟琛� 鍓嶇鎺у埗鍣�
+ * </p>
+*
+* @author ld
+* @since 2025-06-14
+*/
+
+@RestController
+@AllArgsConstructor
+@RequestMapping("/inspectionTask")
+ public class InspectionTaskController {
+
+ }
diff --git a/main-business/src/main/java/com/ruoyi/business/controller/PendingInventoryController.java b/main-business/src/main/java/com/ruoyi/business/controller/PendingInventoryController.java
index 979fe45..16940ff 100644
--- a/main-business/src/main/java/com/ruoyi/business/controller/PendingInventoryController.java
+++ b/main-business/src/main/java/com/ruoyi/business/controller/PendingInventoryController.java
@@ -3,7 +3,6 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.business.dto.PendingInventoryDto;
-import com.ruoyi.business.entity.PendingInventory;
import com.ruoyi.business.service.PendingInventoryService;
import com.ruoyi.common.core.domain.R;
import lombok.AllArgsConstructor;
@@ -29,8 +28,8 @@
* 寰呭叆搴撹〃鏌ヨ
*/
@GetMapping("/list")
- public R<IPage<PendingInventory>> list(Page page, PendingInventoryDto pendingInventoryDto) {
- IPage<PendingInventory> list = pendingInventoryService.selectPendingInventoryList(page, pendingInventoryDto);
+ public R<IPage<PendingInventoryDto>> list(Page page, PendingInventoryDto pendingInventoryDto) {
+ IPage<PendingInventoryDto> list = pendingInventoryService.selectPendingInventoryList(page, pendingInventoryDto);
return R.ok(list);
}
diff --git a/main-business/src/main/java/com/ruoyi/business/controller/ProductionController.java b/main-business/src/main/java/com/ruoyi/business/controller/ProductionController.java
index 7238aff..e995843 100644
--- a/main-business/src/main/java/com/ruoyi/business/controller/ProductionController.java
+++ b/main-business/src/main/java/com/ruoyi/business/controller/ProductionController.java
@@ -25,7 +25,7 @@
private ProductionService productionService;
/**
- * 鏌ヨ
+ * 鐢熶骇鏄庣粏琛ㄦ煡璇�
*/
@GetMapping("/list")
public R<IPage<Production>> list(Page page, ProductionDto productionDto) {
diff --git a/main-business/src/main/java/com/ruoyi/business/controller/ProductionInventoryController.java b/main-business/src/main/java/com/ruoyi/business/controller/ProductionInventoryController.java
new file mode 100644
index 0000000..f805ca9
--- /dev/null
+++ b/main-business/src/main/java/com/ruoyi/business/controller/ProductionInventoryController.java
@@ -0,0 +1,39 @@
+package com.ruoyi.business.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.business.entity.ProductionInventory;
+import com.ruoyi.business.service.ProductionInventoryService;
+import com.ruoyi.common.core.domain.R;
+import lombok.AllArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 鐢熶骇涓昏〃 鍓嶇鎺у埗鍣�
+ * </p>
+ *
+ * @author ld
+ * @since 2025-06-13
+ */
+
+@RestController
+@AllArgsConstructor
+@RequestMapping("/productionInventory")
+public class ProductionInventoryController {
+
+ private ProductionInventoryService productionInventoryService;
+
+
+ /**
+ * 鐢熶骇搴撳瓨鏄庣粏琛ㄦ煡璇�
+ */
+ @GetMapping("/list")
+ public R<IPage<ProductionInventory>> list(Page page,ProductionInventory productionInventory) {
+ IPage<ProductionInventory> list = productionInventoryService.selectPIList(page,productionInventory);
+ return R.ok(list);
+ }
+
+}
diff --git a/main-business/src/main/java/com/ruoyi/business/controller/ProductionMasterController.java b/main-business/src/main/java/com/ruoyi/business/controller/ProductionMasterController.java
new file mode 100644
index 0000000..db20a13
--- /dev/null
+++ b/main-business/src/main/java/com/ruoyi/business/controller/ProductionMasterController.java
@@ -0,0 +1,54 @@
+package com.ruoyi.business.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.business.dto.ProductionMasterDto;
+import com.ruoyi.business.service.ProductionMasterService;
+import com.ruoyi.common.core.domain.R;
+import lombok.AllArgsConstructor;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * <p>
+ * 鐢熶骇涓昏〃 鍓嶇鎺у埗鍣�
+ * </p>
+ *
+ * @author ld
+ * @since 2025-06-13
+ */
+
+@RestController
+@AllArgsConstructor
+@RequestMapping("/productionMaster")
+public class ProductionMasterController {
+
+ private ProductionMasterService productionMasterService;
+
+ /**
+ * 鐢熶骇涓昏〃鏌ヨ
+ */
+ @GetMapping("/list")
+ public R<IPage<ProductionMasterDto>> list(Page page, ProductionMasterDto productionMasterDto) {
+ IPage<ProductionMasterDto> list = productionMasterService.selectPMList(page,productionMasterDto);
+ return R.ok(list);
+ }
+
+ /**
+ * 鐢熶骇涓昏〃鏂板淇敼
+ */
+ @PostMapping("/addOrEditPM")
+ public R addOrEditPM(@RequestBody ProductionMasterDto productionMasterDto) {
+ return R.ok(productionMasterService.addOrEditPM(productionMasterDto));
+ }
+
+ /**
+ * 鍒犻櫎
+ */
+ @DeleteMapping("/delPM")
+ public R remove(@RequestBody Long[] ids) {
+ return R.ok(productionMasterService.delByIds(ids));
+ }
+
+
+
+}
diff --git a/main-business/src/main/java/com/ruoyi/business/dto/InspectionTaskDto.java b/main-business/src/main/java/com/ruoyi/business/dto/InspectionTaskDto.java
new file mode 100644
index 0000000..38520cb
--- /dev/null
+++ b/main-business/src/main/java/com/ruoyi/business/dto/InspectionTaskDto.java
@@ -0,0 +1,8 @@
+package com.ruoyi.business.dto;
+
+import com.ruoyi.business.entity.InspectionTask;
+import lombok.Data;
+
+@Data
+public class InspectionTaskDto extends InspectionTask {
+}
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 2d46d36..8836167 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
@@ -13,6 +13,12 @@
@JsonProperty("pId")
private Long pId;
+ /**
+ * 姝e紡搴搃d
+ */
+ @JsonProperty("officialId")
+ private Long officialId;
+
private List<Map<String, String>> fieldValue;
/**
diff --git a/main-business/src/main/java/com/ruoyi/business/dto/ProductionMasterDto.java b/main-business/src/main/java/com/ruoyi/business/dto/ProductionMasterDto.java
new file mode 100644
index 0000000..7ac7670
--- /dev/null
+++ b/main-business/src/main/java/com/ruoyi/business/dto/ProductionMasterDto.java
@@ -0,0 +1,17 @@
+package com.ruoyi.business.dto;
+
+import com.ruoyi.business.entity.Production;
+import com.ruoyi.business.entity.ProductionInventory;
+import com.ruoyi.business.entity.ProductionMaster;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class ProductionMasterDto extends ProductionMaster {
+
+ private List<Production> productionList; //鐢熶骇鏄庣粏
+
+ private List<ProductionInventory> productionInventoryList; //浣跨敤搴撳瓨鏄庣粏
+
+}
diff --git a/main-business/src/main/java/com/ruoyi/business/entity/InspectionTask.java b/main-business/src/main/java/com/ruoyi/business/entity/InspectionTask.java
new file mode 100644
index 0000000..866a1c4
--- /dev/null
+++ b/main-business/src/main/java/com/ruoyi/business/entity/InspectionTask.java
@@ -0,0 +1,59 @@
+package com.ruoyi.business.entity;
+
+import com.baomidou.mybatisplus.annotation.*;
+import lombok.Data;
+ import com.ruoyi.common.core.domain.MyBaseEntity;
+
+/**
+* 宸℃浠诲姟琛� 瀹炰綋绫�
+*
+* @author ld
+* @date 2025-06-14
+*/
+@Data
+@TableName("inspection_task")
+public class InspectionTask extends MyBaseEntity {
+
+private static final long serialVersionUID = 1L;
+
+ /**
+ * 宸℃浠诲姟鍞竴鏍囪瘑
+ */
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
+ /**
+ * 宸℃浠诲姟鍚嶇О
+ */
+ @TableField(value = "task_name")
+ private String taskName;
+ /**
+ *
+ */
+ @TableField(value = "inspector_id")
+ private Long inspectorId;
+ /**
+ * 鎵ц宸℃鐨勪汉鍛樺鍚�
+ */
+ @TableField(value = "inspector")
+ private String inspector;
+ /**
+ * 宸℃鍦扮偣璇︾粏鎻忚堪
+ */
+ @TableField(value = "port")
+ private String port;
+ /**
+ * 浠诲姟闄勫姞璇存槑鎴栫壒娈婃儏鍐佃褰�
+ */
+ @TableField(value = "remarks")
+ private String remarks;
+ /**
+ *
+ */
+ @TableField(value = "registrant_id")
+ private Long registrantId;
+ /**
+ * 浠诲姟鐧昏浜哄鍚�
+ */
+ @TableField(value = "registrant")
+ private String registrant;
+}
\ No newline at end of file
diff --git a/main-business/src/main/java/com/ruoyi/business/entity/Production.java b/main-business/src/main/java/com/ruoyi/business/entity/Production.java
index 2465357..231294a 100644
--- a/main-business/src/main/java/com/ruoyi/business/entity/Production.java
+++ b/main-business/src/main/java/com/ruoyi/business/entity/Production.java
@@ -28,6 +28,11 @@
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
+ * 鐢熶骇涓昏〃ID
+ */
+ @TableField(value = "production_master_id")
+ private Long productionMasterId;
+ /**
* 鐓ょID
*/
@TableField(value = "coal_id")
@@ -37,11 +42,6 @@
*/
@TableField(value = "coal")
private String coal;
- /**
- * 鐑��
- */
- @TableField(value = "calorific_value")
- private Integer calorificValue;
/**
* 鐢熶骇鏁伴噺
*/
@@ -78,6 +78,11 @@
@TableField(value = "producer")
private String producer;
/**
+ * 鐢熶骇浜篒D
+ */
+ @TableField(value = "producer_id")
+ private String producerId;
+ /**
* 鐢熶骇鏃ユ湡
*/
@TableField(value = "production_date")
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
new file mode 100644
index 0000000..2bad8a1
--- /dev/null
+++ b/main-business/src/main/java/com/ruoyi/business/entity/ProductionInventory.java
@@ -0,0 +1,49 @@
+package com.ruoyi.business.entity;
+
+import com.baomidou.mybatisplus.annotation.*;
+import lombok.Data;
+import com.ruoyi.common.core.domain.MyBaseEntity;
+
+/**
+ * 鐢熶骇涓昏〃 瀹炰綋绫�
+ *
+ * @author ruoyi
+ * @date 2025-06-13
+ */
+@Data
+@TableName("production_inventory")
+public class ProductionInventory extends MyBaseEntity {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 涓婚敭ID
+ */
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
+ /**
+ * 鐢熶骇涓昏〃ID
+ */
+ @TableField(value = "production_master_id")
+ private Long productionMasterId;
+ /**
+ * 鐓ょID
+ */
+ @TableField(value = "coal_id")
+ private Long coalId;
+ /**
+ * 鐓ょ
+ */
+ @TableField(value = "coal")
+ private String coal;
+ /**
+ * 搴撳瓨鏁伴噺
+ */
+ @TableField(value = "inventory_quantity")
+ private Integer inventoryQuantity;
+ /**
+ * 浣跨敤鏁伴噺
+ */
+ @TableField(value = "used_quantity")
+ private Integer usedQuantity;
+}
\ No newline at end of file
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
new file mode 100644
index 0000000..caf15b3
--- /dev/null
+++ b/main-business/src/main/java/com/ruoyi/business/entity/ProductionMaster.java
@@ -0,0 +1,75 @@
+package com.ruoyi.business.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.ruoyi.common.core.domain.MyBaseEntity;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.time.LocalDate;
+
+/**
+ * 鐢熶骇涓昏〃 瀹炰綋绫�
+ *
+ * @author ruoyi
+ * @date 2025-06-13
+ */
+@Data
+@TableName("production_master")
+public class ProductionMaster extends MyBaseEntity {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 涓婚敭ID
+ */
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
+ /**
+ * 鐓ょ
+ */
+ @TableField(value = "coal")
+ private String coal;
+ /**
+ * 鐢熶骇鏁伴噺
+ */
+ @TableField(value = "production_quantity")
+ private Integer productionQuantity;
+ /**
+ * 浜哄伐鎴愭湰
+ */
+ @TableField(value = "labor_cost")
+ private BigDecimal laborCost;
+ /**
+ * 鑳借�楁垚鏈�
+ */
+ @TableField(value = "energy_consumption_cost")
+ private BigDecimal energyConsumptionCost;
+ /**
+ * 璁惧鎶樻棫
+ */
+ @TableField(value = "equipment_depreciation")
+ private BigDecimal equipmentDepreciation;
+ /**
+ * 鎬绘垚鏈�
+ */
+ @TableField(value = "total_cost")
+ private BigDecimal totalCost;
+ /**
+ *
+ */
+ @TableField(value = "producer_id")
+ private String producerId;
+ /**
+ * 鐢熶骇浜�
+ */
+ @TableField(value = "producer")
+ private String producer;
+ /**
+ * 鐢熶骇鏃ユ湡
+ */
+ @TableField(value = "production_date")
+ private LocalDate productionDate;
+}
\ No newline at end of file
diff --git a/main-business/src/main/java/com/ruoyi/business/mapper/InspectionTaskMapper.java b/main-business/src/main/java/com/ruoyi/business/mapper/InspectionTaskMapper.java
new file mode 100644
index 0000000..13d63dd
--- /dev/null
+++ b/main-business/src/main/java/com/ruoyi/business/mapper/InspectionTaskMapper.java
@@ -0,0 +1,18 @@
+package com.ruoyi.business.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.business.entity.InspectionTask;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ * 宸℃浠诲姟琛� Mapper 鎺ュ彛
+ * </p>
+ *
+ * @author ld
+ * @since 2025-06-14
+ */
+@Mapper
+public interface InspectionTaskMapper extends BaseMapper<InspectionTask> {
+
+}
diff --git a/main-business/src/main/java/com/ruoyi/business/mapper/ProductionInventoryMapper.java b/main-business/src/main/java/com/ruoyi/business/mapper/ProductionInventoryMapper.java
new file mode 100644
index 0000000..adf6375
--- /dev/null
+++ b/main-business/src/main/java/com/ruoyi/business/mapper/ProductionInventoryMapper.java
@@ -0,0 +1,18 @@
+package com.ruoyi.business.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.business.entity.ProductionInventory;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ * 鐢熶骇涓昏〃 Mapper 鎺ュ彛
+ * </p>
+ *
+ * @author ruoyi
+ * @since 2025-06-13
+ */
+@Mapper
+public interface ProductionInventoryMapper extends BaseMapper<ProductionInventory> {
+
+}
diff --git a/main-business/src/main/java/com/ruoyi/business/mapper/ProductionMasterMapper.java b/main-business/src/main/java/com/ruoyi/business/mapper/ProductionMasterMapper.java
new file mode 100644
index 0000000..f3119b5
--- /dev/null
+++ b/main-business/src/main/java/com/ruoyi/business/mapper/ProductionMasterMapper.java
@@ -0,0 +1,18 @@
+package com.ruoyi.business.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.business.entity.ProductionMaster;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ * 鐢熶骇涓昏〃 Mapper 鎺ュ彛
+ * </p>
+ *
+ * @author ruoyi
+ * @since 2025-06-13
+ */
+@Mapper
+public interface ProductionMasterMapper extends BaseMapper<ProductionMaster> {
+
+}
diff --git a/main-business/src/main/java/com/ruoyi/business/service/InspectionTaskService.java b/main-business/src/main/java/com/ruoyi/business/service/InspectionTaskService.java
new file mode 100644
index 0000000..803eaab
--- /dev/null
+++ b/main-business/src/main/java/com/ruoyi/business/service/InspectionTaskService.java
@@ -0,0 +1,16 @@
+package com.ruoyi.business.service;
+
+import com.ruoyi.business.entity.InspectionTask;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 宸℃浠诲姟琛� 鏈嶅姟绫�
+ * </p>
+ *
+ * @author ld
+ * @since 2025-06-14
+ */
+public interface InspectionTaskService extends IService<InspectionTask> {
+
+}
diff --git a/main-business/src/main/java/com/ruoyi/business/service/PendingInventoryService.java b/main-business/src/main/java/com/ruoyi/business/service/PendingInventoryService.java
index 5423545..e82d59e 100644
--- a/main-business/src/main/java/com/ruoyi/business/service/PendingInventoryService.java
+++ b/main-business/src/main/java/com/ruoyi/business/service/PendingInventoryService.java
@@ -16,7 +16,7 @@
*/
public interface PendingInventoryService extends IService<PendingInventory> {
- IPage<PendingInventory> selectPendingInventoryList(Page page, PendingInventoryDto pendingInventoryDto);
+ IPage<PendingInventoryDto> selectPendingInventoryList(Page page, PendingInventoryDto pendingInventoryDto);
int addOrEditPending(PendingInventoryDto pendingInventoryDto);
diff --git a/main-business/src/main/java/com/ruoyi/business/service/ProductionInventoryService.java b/main-business/src/main/java/com/ruoyi/business/service/ProductionInventoryService.java
new file mode 100644
index 0000000..0eaf767
--- /dev/null
+++ b/main-business/src/main/java/com/ruoyi/business/service/ProductionInventoryService.java
@@ -0,0 +1,19 @@
+package com.ruoyi.business.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.business.entity.ProductionInventory;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 鐢熶骇涓昏〃 鏈嶅姟绫�
+ * </p>
+ *
+ * @author ruoyi
+ * @since 2025-06-13
+ */
+public interface ProductionInventoryService extends IService<ProductionInventory> {
+
+ IPage<ProductionInventory> selectPIList(Page page, ProductionInventory productionInventory);
+}
diff --git a/main-business/src/main/java/com/ruoyi/business/service/ProductionMasterService.java b/main-business/src/main/java/com/ruoyi/business/service/ProductionMasterService.java
new file mode 100644
index 0000000..7577b79
--- /dev/null
+++ b/main-business/src/main/java/com/ruoyi/business/service/ProductionMasterService.java
@@ -0,0 +1,24 @@
+package com.ruoyi.business.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.business.dto.ProductionMasterDto;
+import com.ruoyi.business.entity.ProductionMaster;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 鐢熶骇涓昏〃 鏈嶅姟绫�
+ * </p>
+ *
+ * @author ruoyi
+ * @since 2025-06-13
+ */
+public interface ProductionMasterService extends IService<ProductionMaster> {
+
+ IPage<ProductionMasterDto> selectPMList(Page page, ProductionMasterDto productionMasterDto);
+
+ int addOrEditPM(ProductionMasterDto productionMasterDto);
+
+ int delByIds(Long[] ids);
+}
diff --git a/main-business/src/main/java/com/ruoyi/business/service/impl/InspectionTaskServiceImpl.java b/main-business/src/main/java/com/ruoyi/business/service/impl/InspectionTaskServiceImpl.java
new file mode 100644
index 0000000..13ce0a9
--- /dev/null
+++ b/main-business/src/main/java/com/ruoyi/business/service/impl/InspectionTaskServiceImpl.java
@@ -0,0 +1,22 @@
+package com.ruoyi.business.service.impl;
+
+import com.ruoyi.business.entity.InspectionTask;
+import com.ruoyi.business.mapper.InspectionTaskMapper;
+ import com.ruoyi.business.service.InspectionTaskService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+import lombok.RequiredArgsConstructor;
+
+/**
+* <p>
+ * 宸℃浠诲姟琛� 鏈嶅姟瀹炵幇绫�
+ * </p>
+*
+* @author ld
+* @since 2025-06-14
+*/
+@Service
+@RequiredArgsConstructor
+ public class InspectionTaskServiceImpl extends ServiceImpl<InspectionTaskMapper, InspectionTask> implements InspectionTaskService {
+
+ }
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 adbc5e9..35c3e91 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
@@ -23,10 +23,7 @@
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
+import java.util.*;
import java.util.stream.Collectors;
/**
@@ -50,10 +47,56 @@
private final CoalFieldMapper coalFieldMapper;
@Override
- public IPage<PendingInventory> selectPendingInventoryList(Page page, PendingInventoryDto pendingInventoryDto) {
+ public IPage<PendingInventoryDto> selectPendingInventoryList(Page page, PendingInventoryDto pendingInventoryDto) {
+ // 1. 鏋勫缓涓绘煡璇�
LambdaQueryWrapper<PendingInventory> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.orderByDesc(PendingInventory::getCreateTime);
- return pendingInventoryMapper.selectPage(page, queryWrapper);
+
+ // 2. 鎵ц涓昏〃鍒嗛〉鏌ヨ
+ IPage<PendingInventory> pendingInventoryPage = pendingInventoryMapper.selectPage(page, queryWrapper);
+
+ // 3. 鏃犳暟鎹揩閫熻繑鍥�
+ if (CollectionUtils.isEmpty(pendingInventoryPage.getRecords())) {
+ return new Page<>(page.getCurrent(), page.getSize(), pendingInventoryPage.getTotal());
+ }
+
+ // 4. 鎻愬彇鎵�鏈夊緟澶勭悊搴撳瓨ID
+ List<Long> pendingIds = pendingInventoryPage.getRecords().stream()
+ .map(PendingInventory::getId)
+ .collect(Collectors.toList());
+
+ // 5. 鎵归噺鏌ヨ鍏宠仈鐨勬寮忓簱瀛樹俊鎭�
+ Map<Long, Long> pendingToOfficialMap = getOfficialInventoryMap(pendingIds);
+
+ // 6. 浣跨敤MyBatis-Plus鐨刢onvert鏂规硶杞崲DTO
+ return pendingInventoryPage.convert(record -> {
+ PendingInventoryDto dto = new PendingInventoryDto();
+ BeanUtils.copyProperties(record, dto);
+
+ // 浠庨鍔犺浇鐨凪ap涓幏鍙杘fficialId
+ dto.setOfficialId(pendingToOfficialMap.getOrDefault(record.getId(), null));
+ return dto;
+ });
+ }
+
+ // 鎵归噺鑾峰彇寰呭鐞嗗簱瀛樹笌姝e紡搴撳瓨鐨勬槧灏勫叧绯�
+ private Map<Long, Long> getOfficialInventoryMap(List<Long> pendingIds) {
+ if (CollectionUtils.isEmpty(pendingIds)) {
+ return Collections.emptyMap();
+ }
+
+ // 鏌ヨ鍏宠仈鐨勬寮忓簱瀛樻暟鎹�
+ LambdaQueryWrapper<OfficialInventory> wrapper = new LambdaQueryWrapper<>();
+ wrapper.select(OfficialInventory::getId, OfficialInventory::getPendingId)
+ .in(OfficialInventory::getPendingId, pendingIds);
+
+ return officialInventoryMapper.selectList(wrapper)
+ .stream()
+ .collect(Collectors.toMap(
+ OfficialInventory::getPendingId,
+ OfficialInventory::getId,
+ (existing, replacement) -> existing // 濡傛灉鏈夐噸澶嶏紝淇濈暀绗竴涓�
+ ));
}
@Override
@@ -135,13 +178,19 @@
} else {
pendingInventoryMapper.deleteById(pendingInventoryDto.getPId());
}
- officialInventoryMapper.delete(new LambdaQueryWrapper<OfficialInventory>().eq(OfficialInventory::getPendingId, pendingInventoryDto.getPId()));
- OfficialInventory officialInventory = new OfficialInventory();
- BeanUtils.copyProperties(pendingInventory, officialInventory);
- officialInventory.setId(null);
- officialInventory.setPendingId(pendingInventoryDto.getPId());
- officialInventory.setInventoryQuantity(quantity);
- officialInventoryMapper.insert(officialInventory);
+ //姝e紡搴�
+ if (pendingInventoryDto.getOfficialId() == null) {
+ OfficialInventory officialInventory = new OfficialInventory();
+ BeanUtils.copyProperties(pendingInventory, officialInventory);
+ officialInventory.setId(null);
+ officialInventory.setPendingId(pendingInventoryDto.getPId());
+ officialInventory.setInventoryQuantity(quantity);
+ officialInventoryMapper.insert(officialInventory);
+ }else {
+ OfficialInventory officialInventory = officialInventoryMapper.selectById(pendingInventoryDto.getOfficialId());
+ officialInventory.setInventoryQuantity(quantity.add(officialInventory.getInventoryQuantity()));
+ officialInventoryMapper.updateById(officialInventory);
+ }
}
return i;
}
diff --git a/main-business/src/main/java/com/ruoyi/business/service/impl/ProductionInventoryServiceImpl.java b/main-business/src/main/java/com/ruoyi/business/service/impl/ProductionInventoryServiceImpl.java
new file mode 100644
index 0000000..882373f
--- /dev/null
+++ b/main-business/src/main/java/com/ruoyi/business/service/impl/ProductionInventoryServiceImpl.java
@@ -0,0 +1,33 @@
+package com.ruoyi.business.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.business.entity.ProductionInventory;
+import com.ruoyi.business.mapper.ProductionInventoryMapper;
+import com.ruoyi.business.service.ProductionInventoryService;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 鐢熶骇涓昏〃 鏈嶅姟瀹炵幇绫�
+ * </p>
+ *
+ * @author ruoyi
+ * @since 2025-06-13
+ */
+@Service
+@RequiredArgsConstructor
+public class ProductionInventoryServiceImpl extends ServiceImpl<ProductionInventoryMapper, ProductionInventory> implements ProductionInventoryService {
+
+ private final ProductionInventoryMapper productionInventoryMapper;
+
+ @Override
+ public IPage<ProductionInventory> selectPIList(Page page,ProductionInventory productionInventory) {
+ LambdaQueryWrapper<ProductionInventory> queryWrapper = new LambdaQueryWrapper<>();
+ queryWrapper.orderByDesc(ProductionInventory::getCreateTime);
+ return productionInventoryMapper.selectPage(page, queryWrapper);
+ }
+}
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
new file mode 100644
index 0000000..28f3652
--- /dev/null
+++ b/main-business/src/main/java/com/ruoyi/business/service/impl/ProductionMasterServiceImpl.java
@@ -0,0 +1,215 @@
+package com.ruoyi.business.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.business.dto.ProductionMasterDto;
+import com.ruoyi.business.entity.Production;
+import com.ruoyi.business.entity.ProductionInventory;
+import com.ruoyi.business.entity.ProductionMaster;
+import com.ruoyi.business.mapper.OfficialInventoryMapper;
+import com.ruoyi.business.mapper.ProductionInventoryMapper;
+import com.ruoyi.business.mapper.ProductionMapper;
+import com.ruoyi.business.mapper.ProductionMasterMapper;
+import com.ruoyi.business.service.ProductionMasterService;
+import com.ruoyi.common.utils.bean.BeanUtils;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.math.BigDecimal;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * <p>
+ * 鐢熶骇涓昏〃 鏈嶅姟瀹炵幇绫�
+ * </p>
+ *
+ * @author ruoyi
+ * @since 2025-06-13
+ */
+@Service
+@RequiredArgsConstructor
+public class ProductionMasterServiceImpl extends ServiceImpl<ProductionMasterMapper, ProductionMaster> implements ProductionMasterService {
+
+ private final ProductionMasterMapper productionMasterMapper;
+
+ private final ProductionInventoryMapper productionInventoryMapper;
+
+ private final ProductionMapper productionMapper;
+
+ private final OfficialInventoryMapper officialInventoryMapper;
+
+ @Override
+ public IPage<ProductionMasterDto> selectPMList(Page page, ProductionMasterDto productionMasterDto) {
+ // 1. 鏋勫缓涓昏〃鏌ヨ鏉′欢
+ LambdaQueryWrapper<ProductionMaster> masterQueryWrapper = new LambdaQueryWrapper<>();
+
+ // 2. 鎵ц涓昏〃鍒嗛〉鏌ヨ
+ IPage<ProductionMaster> entityPage = productionMasterMapper.selectPage(page, masterQueryWrapper);
+
+ // 3. 鎻愬彇涓昏〃ID鍒楄〃鐢ㄤ簬鎵归噺鏌ヨ瀛愯〃鏁版嵁
+ List<Long> masterIds = entityPage.getRecords().stream()
+ .map(ProductionMaster::getId)
+ .collect(Collectors.toList());
+
+ // 4. 鎵归噺鏌ヨ鍏宠仈鏁版嵁锛堥伩鍏峃+1闂锛�
+ Map<Long, List<Production>> productionMap = queryProductionByMasterIds(masterIds);
+ Map<Long, List<ProductionInventory>> inventoryMap = queryInventoryByMasterIds(masterIds);
+
+ // 5. 杞崲鏁版嵁骞剁粍瑁呯粨鏋�
+ List<ProductionMasterDto> dtoList = entityPage.getRecords().stream()
+ .map(record -> {
+ ProductionMasterDto dto = new ProductionMasterDto();
+ BeanUtils.copyProperties(record, dto);
+ dto.setProductionList(productionMap.getOrDefault(record.getId(), Collections.emptyList()));
+ dto.setProductionInventoryList(inventoryMap.getOrDefault(record.getId(), Collections.emptyList()));
+ return dto;
+ })
+ .collect(Collectors.toList());
+
+ // 6. 鏋勫缓杩斿洖缁撴灉
+ IPage<ProductionMasterDto> dtoPage = new Page<>();
+ BeanUtils.copyProperties(entityPage, dtoPage, "records");
+ dtoPage.setRecords(dtoList);
+
+ return dtoPage;
+ }
+
+ /**
+ * 鎵归噺鏌ヨProduction鏁版嵁
+ */
+ private Map<Long, List<Production>> queryProductionByMasterIds(List<Long> masterIds) {
+ if (masterIds.isEmpty()) {
+ return Collections.emptyMap();
+ }
+
+ LambdaQueryWrapper<Production> queryWrapper = new LambdaQueryWrapper<>();
+ queryWrapper.in(Production::getProductionMasterId, masterIds);
+ List<Production> productions = productionMapper.selectList(queryWrapper);
+
+ return productions.stream()
+ .collect(Collectors.groupingBy(Production::getProductionMasterId));
+ }
+
+ /**
+ * 鎵归噺鏌ヨProductionInventory鏁版嵁
+ */
+ private Map<Long, List<ProductionInventory>> queryInventoryByMasterIds(List<Long> masterIds) {
+ if (masterIds.isEmpty()) {
+ return Collections.emptyMap();
+ }
+
+ LambdaQueryWrapper<ProductionInventory> queryWrapper = new LambdaQueryWrapper<>();
+ queryWrapper.in(ProductionInventory::getProductionMasterId, masterIds);
+ List<ProductionInventory> inventoryList = productionInventoryMapper.selectList(queryWrapper);
+
+ return inventoryList.stream()
+ .collect(Collectors.groupingBy(ProductionInventory::getProductionMasterId));
+ }
+
+ @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;
+ int totalProductionQuantity = 0;
+ StringBuilder coalBuilder = new StringBuilder("["); // 浼樺寲瀛楃涓叉嫾鎺�
+
+ 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();
+ coalBuilder.append(production.getCoal()).append(",");
+ }
+
+ // 澶勭悊coal瀛楃涓叉嫾鎺�
+ String coalStr = coalBuilder.length() > 1 ?
+ coalBuilder.deleteCharAt(coalBuilder.length()-1).append("]").toString() : "[]";
+
+ // 2. 鍒涘缓涓昏〃瀵硅薄
+ ProductionMaster productionMaster = new ProductionMaster();
+ productionMaster.setProductionQuantity(totalProductionQuantity);
+ productionMaster.setTotalCost(totalTotalCost);
+ productionMaster.setEquipmentDepreciation(totalEquipmentDepreciation);
+ productionMaster.setEnergyConsumptionCost(totalEnergyConsumptionCost);
+ productionMaster.setLaborCost(totalLaborCost);
+ productionMaster.setCoal(coalStr);
+
+ Long masterId = productionMasterDto.getId();
+ productionMaster.setId(masterId);
+
+ // 3. 缁熶竴瀛愯〃澶勭悊閫昏緫
+ if (masterId == null) {
+ productionMasterMapper.insert(productionMaster);
+ masterId = productionMaster.getId(); // 鑾峰彇鏂扮敓鎴愮殑ID
+ } else {
+ // 鍒犻櫎鍏宠仈瀛愯〃鏁版嵁锛堜娇鐢ㄦ洿楂樻晥鐨刬n鍒犻櫎锛�
+ productionMapper.delete(new LambdaQueryWrapper<Production>()
+ .eq(Production::getProductionMasterId, masterId));
+
+ productionInventoryMapper.delete(new LambdaQueryWrapper<ProductionInventory>()
+ .eq(ProductionInventory::getProductionMasterId, masterId));
+
+ productionMasterMapper.updateById(productionMaster);
+ }
+
+ // 4. 鎵归噺鎻掑叆瀛愯〃鏁版嵁
+ batchInsertProductions(masterId, productionMasterDto.getProductionList());
+ batchInsertInventories(masterId, productionMasterDto.getProductionInventoryList());
+
+ return 1;
+ }
+
+ // 鎵归噺鎻掑叆鐢熶骇鏁版嵁
+ private void batchInsertProductions(Long masterId, List<Production> productions) {
+ List<Production> insertList = productions.stream()
+ .peek(p -> {
+ p.setId(null);
+ p.setProductionMasterId(masterId);
+ })
+ .collect(Collectors.toList());
+
+ if (!insertList.isEmpty()) {
+ for (Production production : productions) {
+ production.setId(null);
+ production.setProductionMasterId(masterId);
+ productionMapper.insert(production);
+ }
+ }
+ }
+
+ // 鎵归噺鎻掑叆搴撳瓨鏁版嵁
+ private void batchInsertInventories(Long masterId, List<ProductionInventory> inventories) {
+ List<ProductionInventory> insertList = inventories.stream()
+ .peek(inv -> {
+ inv.setId(null);
+ inv.setProductionMasterId(masterId);
+ })
+ .collect(Collectors.toList());
+
+ if (!insertList.isEmpty()) {
+ for (ProductionInventory inventory : inventories) {
+ inventory.setId(null);
+ inventory.setProductionMasterId(masterId);
+ productionInventoryMapper.insert(inventory);
+ }
+ }
+ }
+
+ @Override
+ public int delByIds(Long[] ids) {
+ return 0;
+ }
+}
diff --git a/main-business/src/main/resources/db/migration/postgresql/V20250604101800__create_table_production.sql b/main-business/src/main/resources/db/migration/postgresql/V20250604101800__create_table_production.sql
index 31bc9b2..2f9b09e 100644
--- a/main-business/src/main/resources/db/migration/postgresql/V20250604101800__create_table_production.sql
+++ b/main-business/src/main/resources/db/migration/postgresql/V20250604101800__create_table_production.sql
@@ -1,24 +1,25 @@
-- 鍒涘缓鐢熶骇鏄庣粏琛�
CREATE TABLE production
(
- id BIGSERIAL PRIMARY KEY, -- 涓婚敭ID
- coal_id BIGINT NOT NULL DEFAULT 0, -- 鐓ょID
- coal VARCHAR(50) NOT NULL, -- 鐓ょ
- calorific_value INT NOT NULL, -- 鐑��
- production_quantity INT NOT NULL, -- 鐢熶骇鏁伴噺
- labor_cost DECIMAL(10, 2) NOT NULL, -- 浜哄伐鎴愭湰
- energy_consumption_cost DECIMAL(10, 2) NOT NULL, -- 鑳借�楁垚鏈�
- equipment_depreciation DECIMAL(10, 2) NOT NULL, -- 璁惧鎶樻棫
- purchase_price DECIMAL(10, 2) NOT NULL, -- 閲囪喘鍗曚环
- total_cost DECIMAL(10, 2) NOT NULL, -- 鎬绘垚鏈�
- producer VARCHAR(50), -- 鐢熶骇浜�
- production_date DATE, -- 鐢熶骇鏃ユ湡
+ id BIGSERIAL PRIMARY KEY, -- 涓婚敭ID
+ production_master_id BIGINT NOT NULL DEFAULT 0, -- 鐢熶骇涓昏〃ID
+ coal_id BIGINT NOT NULL DEFAULT 0, -- 鐓ょID
+ coal VARCHAR(50) NOT NULL, -- 鐓ょ
+ production_quantity INT NOT NULL, -- 鐢熶骇鏁伴噺
+ labor_cost DECIMAL(10, 2) NOT NULL, -- 浜哄伐鎴愭湰
+ energy_consumption_cost DECIMAL(10, 2) NOT NULL, -- 鑳借�楁垚鏈�
+ equipment_depreciation DECIMAL(10, 2) NOT NULL, -- 璁惧鎶樻棫
+ purchase_price DECIMAL(10, 2) NOT NULL, -- 閲囪喘鍗曚环
+ total_cost DECIMAL(10, 2) NOT NULL, -- 鎬绘垚鏈�
+ producer_id VARCHAR(50), -- 鐢熶骇浜篿d
+ producer VARCHAR(50), -- 鐢熶骇浜�
+ production_date DATE, -- 鐢熶骇鏃ユ湡
- 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 -- 鏈�鍚庢洿鏂版椂闂达紝榛樿褰撳墠鏃堕棿
);
-- 娣诲姞琛ㄦ敞閲�
@@ -28,7 +29,6 @@
COMMENT ON COLUMN production.id IS '涓婚敭ID';
COMMENT ON COLUMN production.coal_id IS '鐓ょID';
COMMENT ON COLUMN production.coal IS '鐓ょ';
-COMMENT ON COLUMN production.calorific_value IS '鐑��';
COMMENT ON COLUMN production.production_quantity IS '鐢熶骇鏁伴噺';
COMMENT ON COLUMN production.labor_cost IS '浜哄伐鎴愭湰';
COMMENT ON COLUMN production.energy_consumption_cost IS '鑳借�楁垚鏈�';
diff --git a/main-business/src/main/resources/db/migration/postgresql/V20250613093400__create_table_production_master.sql b/main-business/src/main/resources/db/migration/postgresql/V20250613093400__create_table_production_master.sql
new file mode 100644
index 0000000..f5343db
--- /dev/null
+++ b/main-business/src/main/resources/db/migration/postgresql/V20250613093400__create_table_production_master.sql
@@ -0,0 +1,40 @@
+-- 鍒涘缓鐢熶骇鏄庣粏琛�
+CREATE TABLE production_master
+(
+ id BIGSERIAL PRIMARY KEY, -- 涓婚敭ID
+ coal VARCHAR(50) NOT NULL, -- 鐓ょ
+ production_quantity INT NOT NULL, -- 鐢熶骇鏁伴噺
+ labor_cost DECIMAL(10, 2) NOT NULL, -- 浜哄伐鎴愭湰
+ energy_consumption_cost DECIMAL(10, 2) NOT NULL, -- 鑳借�楁垚鏈�
+ equipment_depreciation DECIMAL(10, 2) NOT NULL, -- 璁惧鎶樻棫
+ total_cost DECIMAL(10, 2) NOT NULL, -- 鎬绘垚鏈�
+ producer_id VARCHAR(50), -- 鐢熶骇浜篿d
+ producer VARCHAR(50), -- 鐢熶骇浜�
+ production_date DATE, -- 鐢熶骇鏃ユ湡
+
+ 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 -- 鏈�鍚庢洿鏂版椂闂达紝榛樿褰撳墠鏃堕棿
+);
+
+-- 娣诲姞琛ㄦ敞閲�
+COMMENT ON TABLE production_master IS '鐢熶骇涓昏〃';
+
+-- 娣诲姞瀛楁娉ㄩ噴
+COMMENT ON COLUMN production_master.id IS '涓婚敭ID';
+COMMENT ON COLUMN production_master.coal IS '鐓ょ';
+COMMENT ON COLUMN production_master.production_quantity IS '鐢熶骇鏁伴噺';
+COMMENT ON COLUMN production_master.labor_cost IS '浜哄伐鎴愭湰';
+COMMENT ON COLUMN production_master.energy_consumption_cost IS '鑳借�楁垚鏈�';
+COMMENT ON COLUMN production_master.equipment_depreciation IS '璁惧鎶樻棫';
+COMMENT ON COLUMN production_master.total_cost IS '鎬绘垚鏈�';
+COMMENT ON COLUMN production_master.producer IS '鐢熶骇浜�';
+COMMENT ON COLUMN production_master.production_date IS '鐢熶骇鏃ユ湡';
+
+COMMENT ON COLUMN production_master.deleted IS '杞垹闄ゆ爣蹇楋紝0=鏈垹闄わ紝1=宸插垹闄�';
+COMMENT ON COLUMN production_master.create_by IS '鍒涘缓璇ヨ褰曠殑鐢ㄦ埛';
+COMMENT ON COLUMN production_master.create_time IS '璁板綍鍒涘缓鏃堕棿';
+COMMENT ON COLUMN production_master.update_by IS '鏈�鍚庝慨鏀硅璁板綍鐨勭敤鎴�';
+COMMENT ON COLUMN production_master.update_time IS '璁板綍鏈�鍚庢洿鏂版椂闂�';
\ No newline at end of file
diff --git a/main-business/src/main/resources/db/migration/postgresql/V20250613112800__create_table_production_inventory.sql b/main-business/src/main/resources/db/migration/postgresql/V20250613112800__create_table_production_inventory.sql
new file mode 100644
index 0000000..37318d5
--- /dev/null
+++ b/main-business/src/main/resources/db/migration/postgresql/V20250613112800__create_table_production_inventory.sql
@@ -0,0 +1,34 @@
+-- 鍒涘缓鐢熶骇鏄庣粏琛�
+CREATE TABLE production_inventory
+(
+ id BIGSERIAL PRIMARY KEY, -- 涓婚敭ID
+ production_master_id BIGINT NOT NULL DEFAULT 0, -- 鐢熶骇涓昏〃ID
+ coal_id BIGINT NOT NULL DEFAULT 0, -- 鐓ょID
+ coal VARCHAR(50) NOT NULL, -- 鐓ょ
+ inventory_quantity INT NOT NULL, -- 搴撳瓨鏁伴噺
+ used_quantity INT NOT NULL, -- 浣跨敤鏁伴噺
+
+
+ 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 -- 鏈�鍚庢洿鏂版椂闂达紝榛樿褰撳墠鏃堕棿
+);
+
+-- 娣诲姞琛ㄦ敞閲�
+COMMENT ON TABLE production_inventory IS '鐢熶骇涓昏〃';
+
+-- 娣诲姞瀛楁娉ㄩ噴
+COMMENT ON COLUMN production_inventory.id IS '涓婚敭ID';
+COMMENT ON COLUMN production_inventory.production_master_id IS '鐢熶骇涓昏〃ID';
+COMMENT ON COLUMN production_inventory.coal_id IS '鐓ょID';
+COMMENT ON COLUMN production_inventory.coal IS '鐓ょ';
+COMMENT ON COLUMN production_inventory.inventory_quantity IS '搴撳瓨鏁伴噺';
+COMMENT ON COLUMN production_inventory.used_quantity IS '浣跨敤鏁伴噺';
+
+COMMENT ON COLUMN production_inventory.deleted IS '杞垹闄ゆ爣蹇楋紝0=鏈垹闄わ紝1=宸插垹闄�';
+COMMENT ON COLUMN production_inventory.create_by IS '鍒涘缓璇ヨ褰曠殑鐢ㄦ埛';
+COMMENT ON COLUMN production_inventory.create_time IS '璁板綍鍒涘缓鏃堕棿';
+COMMENT ON COLUMN production_inventory.update_by IS '鏈�鍚庝慨鏀硅璁板綍鐨勭敤鎴�';
+COMMENT ON COLUMN production_inventory.update_time IS '璁板綍鏈�鍚庢洿鏂版椂闂�';
\ No newline at end of file
diff --git a/main-business/src/main/resources/db/migration/postgresql/V20250614134700__create_table_inspection_task.sql b/main-business/src/main/resources/db/migration/postgresql/V20250614134700__create_table_inspection_task.sql
new file mode 100644
index 0000000..d469e66
--- /dev/null
+++ b/main-business/src/main/resources/db/migration/postgresql/V20250614134700__create_table_inspection_task.sql
@@ -0,0 +1,34 @@
+-- 鍒涘缓宸℃浠诲姟琛�
+CREATE TABLE inspection_task
+(
+ id BIGSERIAL PRIMARY KEY, -- 浠诲姟ID (涓婚敭锛岃嚜澧為暱)
+ task_name VARCHAR(255), -- 浠诲姟鍚嶇О
+ inspector_id BIGINT, -- 宸℃浜哄憳id
+ inspector VARCHAR(100), -- 宸℃浜哄憳
+ port TEXT, -- 宸℃鍦扮偣
+ remarks TEXT, -- 澶囨敞璇存槑
+ registrant_id BIGINT, -- 鐧昏浜哄憳id
+ registrant VARCHAR(100), -- 鐧昏浜哄憳
+
+ 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 -- 鏈�鍚庢洿鏂版椂闂达紝榛樿褰撳墠鏃堕棿
+);
+-- 娣诲姞琛ㄦ敞閲�
+COMMENT ON TABLE inspection_task IS '宸℃浠诲姟琛�';
+
+-- 娣诲姞瀛楁娉ㄩ噴
+COMMENT ON COLUMN inspection_task.id IS '宸℃浠诲姟鍞竴鏍囪瘑';
+COMMENT ON COLUMN inspection_task.task_name IS '宸℃浠诲姟鍚嶇О';
+COMMENT ON COLUMN inspection_task.inspector IS '鎵ц宸℃鐨勪汉鍛樺鍚�';
+COMMENT ON COLUMN inspection_task.port IS '宸℃鍦扮偣璇︾粏鎻忚堪';
+COMMENT ON COLUMN inspection_task.remarks IS '浠诲姟闄勫姞璇存槑鎴栫壒娈婃儏鍐佃褰�';
+COMMENT ON COLUMN inspection_task.registrant IS '浠诲姟鐧昏浜哄鍚�';
+
+COMMENT ON COLUMN inspection_task.deleted IS '杞垹闄ゆ爣蹇楋紝0=鏈垹闄わ紝1=宸插垹闄�';
+COMMENT ON COLUMN inspection_task.create_by IS '鍒涘缓璇ヨ褰曠殑鐢ㄦ埛';
+COMMENT ON COLUMN inspection_task.create_time IS '璁板綍鍒涘缓鏃堕棿';
+COMMENT ON COLUMN inspection_task.update_by IS '鏈�鍚庝慨鏀硅璁板綍鐨勭敤鎴�';
+COMMENT ON COLUMN inspection_task.update_time IS '璁板綍鏈�鍚庢洿鏂版椂闂�';
\ No newline at end of file
diff --git a/main-business/src/main/resources/mapper/InspectionTaskMapper.xml b/main-business/src/main/resources/mapper/InspectionTaskMapper.xml
new file mode 100644
index 0000000..32d74df
--- /dev/null
+++ b/main-business/src/main/resources/mapper/InspectionTaskMapper.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.business.mapper.InspectionTaskMapper">
+
+ <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
+ <resultMap id="BaseResultMap" type="com.ruoyi.business.entity.InspectionTask">
+ <id column="id" property="id" />
+ <result column="deleted" property="deleted" />
+ <result column="create_by" property="createBy" />
+ <result column="create_time" property="createTime" />
+ <result column="update_by" property="updateBy" />
+ <result column="update_time" property="updateTime" />
+ <result column="task_name" property="taskName" />
+ <result column="inspector_id" property="inspectorId" />
+ <result column="inspector" property="inspector" />
+ <result column="port" property="port" />
+ <result column="remarks" property="remarks" />
+ <result column="registrant_id" property="registrantId" />
+ <result column="registrant" property="registrant" />
+ </resultMap>
+
+ <!-- 閫氱敤鏌ヨ缁撴灉鍒� -->
+ <sql id="Base_Column_List">
+ deleted,
+ create_by,
+ create_time,
+ update_by,
+ update_time,
+ id, task_name, inspector_id, inspector, port, remarks, registrant_id, registrant
+ </sql>
+
+</mapper>
\ No newline at end of file
diff --git a/main-business/src/main/resources/mapper/ProductionInventoryMapper.xml b/main-business/src/main/resources/mapper/ProductionInventoryMapper.xml
new file mode 100644
index 0000000..ccc64bc
--- /dev/null
+++ b/main-business/src/main/resources/mapper/ProductionInventoryMapper.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.business.mapper.ProductionInventoryMapper">
+
+ <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
+ <resultMap id="BaseResultMap" type="com.ruoyi.business.entity.ProductionInventory">
+ <id column="id" property="id" />
+ <result column="deleted" property="deleted" />
+ <result column="create_by" property="createBy" />
+ <result column="create_time" property="createTime" />
+ <result column="update_by" property="updateBy" />
+ <result column="update_time" property="updateTime" />
+ <result column="production_master_id" property="productionMasterId" />
+ <result column="coal_id" property="coalId" />
+ <result column="coal" property="coal" />
+ <result column="inventory_quantity" property="inventoryQuantity" />
+ <result column="used_quantity" property="usedQuantity" />
+ </resultMap>
+
+ <!-- 閫氱敤鏌ヨ缁撴灉鍒� -->
+ <sql id="Base_Column_List">
+ deleted,
+ create_by,
+ create_time,
+ update_by,
+ update_time,
+ id, production_master_id, coal_id, coal, inventory_quantity, used_quantity
+ </sql>
+
+</mapper>
\ No newline at end of file
diff --git a/main-business/src/main/resources/mapper/ProductionMasterMapper.xml b/main-business/src/main/resources/mapper/ProductionMasterMapper.xml
new file mode 100644
index 0000000..8693267
--- /dev/null
+++ b/main-business/src/main/resources/mapper/ProductionMasterMapper.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.business.mapper.ProductionMasterMapper">
+
+ <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
+ <resultMap id="BaseResultMap" type="com.ruoyi.business.entity.ProductionMaster">
+ <id column="id" property="id" />
+ <result column="deleted" property="deleted" />
+ <result column="create_by" property="createBy" />
+ <result column="create_time" property="createTime" />
+ <result column="update_by" property="updateBy" />
+ <result column="update_time" property="updateTime" />
+ <result column="coal" property="coal" />
+ <result column="production_quantity" property="productionQuantity" />
+ <result column="labor_cost" property="laborCost" />
+ <result column="energy_consumption_cost" property="energyConsumptionCost" />
+ <result column="equipment_depreciation" property="equipmentDepreciation" />
+ <result column="total_cost" property="totalCost" />
+ <result column="producer_id" property="producerId" />
+ <result column="producer" property="producer" />
+ <result column="production_date" property="productionDate" />
+ </resultMap>
+
+ <!-- 閫氱敤鏌ヨ缁撴灉鍒� -->
+ <sql id="Base_Column_List">
+ deleted,
+ create_by,
+ create_time,
+ update_by,
+ update_time,
+ id, coal, production_quantity, labor_cost, energy_consumption_cost, equipment_depreciation, total_cost, producer_id, producer, production_date
+ </sql>
+
+</mapper>
\ No newline at end of file
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/PlusCodeGenerator.java b/ruoyi-admin/src/main/java/com/ruoyi/PlusCodeGenerator.java
index ffd4834..1aa8746 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/PlusCodeGenerator.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/PlusCodeGenerator.java
@@ -34,12 +34,13 @@
// 椤圭洰鍩虹閰嶇疆
private static final String BASE_PACKAGE = "com.ruoyi";
- private static final String MODULE_NAME = "basic"; // 妯″潡鍚�
+ private static final String MODULE_NAME = "business"; // 妯″潡鍚�
public static void main(String[] args) {
String projectPath = System.getProperty("user.dir"); // 鑾峰彇椤圭洰鏍硅矾寰�
- String path = "basic-server"; // 妯″潡鍚嶇О
- String table = "coal_info"; // 琛ㄥ悕锛屽涓〃閫楀彿闅斿紑
+ String path = "main-business"; // 妯″潡鍚嶇О
+ String table = "inspection_task"; // 琛ㄥ悕,澶氫釜琛ㄩ�楀彿闅斿紑
+ String author = "ld"; // 浣滆�呬俊鎭�
// 浠g爜杈撳嚭璺緞閰嶇疆
String outputBasePath = Paths.get(projectPath, path, "src", "main", "java").toString();
@@ -48,7 +49,7 @@
// 浠g爜鐢熸垚鏍稿績閰嶇疆
FastAutoGenerator.create(DB_URL, DB_USERNAME, DB_PASSWORD)
.globalConfig(builder -> {
- builder.author("ld") // 浣滆�呬俊鎭�
+ builder.author(author) // 浣滆�呬俊鎭�
.outputDir(outputBasePath) // 浠g爜杈撳嚭鐩綍
.dateType(DateType.ONLY_DATE) // 鏃ユ湡绫诲瀷
.commentDate("yyyy-MM-dd") // 娉ㄩ噴鏃ユ湡鏍煎紡
@@ -128,7 +129,7 @@
)); // 鍩虹被瀛楁
customMap.put("idType", "AUTO"); // 涓婚敭绫诲瀷
customMap.put("superEntityClass", "com.ruoyi.common.core.domain.MyBaseEntity"); // 鍩虹被鍏ㄨ矾寰�
- customMap.put("author", "ruoyi"); // 浣滆�呬俊鎭�
+ customMap.put("author", author); // 浣滆�呬俊鎭�
customMap.put("packageName", BASE_PACKAGE + "." + MODULE_NAME); // 鍖呭悕
customMap.put("tableName", table); // 琛ㄥ悕
diff --git a/ruoyi-admin/src/main/resources/templates/controller.Java.ftl b/ruoyi-admin/src/main/resources/templates/controller.Java.ftl
index 3e51536..dda4c0c 100644
--- a/ruoyi-admin/src/main/resources/templates/controller.Java.ftl
+++ b/ruoyi-admin/src/main/resources/templates/controller.Java.ftl
@@ -26,7 +26,7 @@
@Controller
</#if>
@AllArgsConstructor
-@RequestMapping("<#if package.ModuleName?? && package.ModuleName != "">/${package.ModuleName}</#if>/<#if controllerMappingHyphenStyle>${controllerMappingHyphen}<#else>${table.entityPath}</#if>")
+@RequestMapping("/<#if controllerMappingHyphenStyle>${controllerMappingHyphen}<#else>${table.entityPath}</#if>")
<#if kotlin>
class ${table.controllerName}<#if superControllerClass??> : ${superControllerClass}()</#if>
<#else>
--
Gitblit v1.9.3