From a0a32468bd6f5e887938674d3c2cf70cc2f555b8 Mon Sep 17 00:00:00 2001
From: 李白 <7387820+wjli_13439841639@user.noreply.gitee.com>
Date: 星期五, 15 五月 2026 08:33:27 +0800
Subject: [PATCH] 开会后对客商排产计划,销售人员的整体修改1

---
 platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/mapper/PlanSubjectMatterMapper.java            |   11 ++
 platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/PlanSubjectMatterServiceImpl.java |   16 ++++
 platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/ProductionPlanController.java       |   41 +++++-----
 platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/PlanSubjectMatter.java                  |    4 +
 platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/PlanSubjectMatterController.java    |  119 +++++++++++++++++++++++++++++
 platformx-business-finance-biz/src/main/resources/mapper/PlanSubjectMatterMapper.xml                                        |   19 ++++
 platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/ProductionPlan.java                     |    4 -
 platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/PlanSubjectMatterService.java          |    8 ++
 8 files changed, 198 insertions(+), 24 deletions(-)

diff --git a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/PlanSubjectMatter.java b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/PlanSubjectMatter.java
index afc004c..5c9b4a9 100644
--- a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/PlanSubjectMatter.java
+++ b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/PlanSubjectMatter.java
@@ -19,6 +19,10 @@
 @Comment("鎺掍骇璁″垝鏍囩殑鐗�")
 public class PlanSubjectMatter extends BaseModel<PlanSubjectMatter> {
 
+    @Schema(description = "鎺掍骇璁″垝Id")
+    @Column(columnDefinition = "bigint comment '鎺掍骇璁″垝Id'")
+    private Long planId;
+
     @Schema(description = "浜у搧Id")
     @Column(columnDefinition = "bigint comment '浜у搧Id'")
     private Long productId;
diff --git a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/ProductionPlan.java b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/ProductionPlan.java
index 7deeee8..083b595 100644
--- a/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/ProductionPlan.java
+++ b/platformx-business-finance-api/src/main/java/com/by4cloud/platformx/business/entity/ProductionPlan.java
@@ -128,10 +128,6 @@
      */
     @Transient
     @TableField(exist = false)
-    private List<ContractSubjectMatter> contractSubjectMatterList;
-
-    @Transient
-    @TableField(exist = false)
     private List<PlanSubjectMatter> planSubjectMatterList;
 
 }
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/PlanSubjectMatterController.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/PlanSubjectMatterController.java
new file mode 100644
index 0000000..01be06a
--- /dev/null
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/PlanSubjectMatterController.java
@@ -0,0 +1,119 @@
+package com.by4cloud.platformx.business.controller;
+
+import cn.hutool.core.util.ArrayUtil;
+import cn.hutool.core.collection.CollUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.by4cloud.platformx.common.core.util.R;
+import com.by4cloud.platformx.common.log.annotation.SysLog;
+import com.by4cloud.platformx.business.entity.PlanSubjectMatter;
+import com.by4cloud.platformx.business.service.PlanSubjectMatterService;
+import org.springframework.security.access.prepost.PreAuthorize;
+import com.by4cloud.platformx.common.excel.annotation.ResponseExcel;
+import io.swagger.v3.oas.annotations.security.SecurityRequirement;
+import org.springdoc.core.annotations.ParameterObject;
+import org.springframework.http.HttpHeaders;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Operation;
+import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * 鎺掍骇璁″垝鏍囩殑鐗�
+ *
+ * @author platformx
+ * @date 2026-05-14 10:55:14
+ */
+@RestController
+@RequiredArgsConstructor
+@RequestMapping("/planSubjectMatter" )
+@Tag(description = "planSubjectMatter" , name = "鎺掍骇璁″垝鏍囩殑鐗╃鐞�" )
+@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
+public class PlanSubjectMatterController {
+
+    private final  PlanSubjectMatterService planSubjectMatterService;
+
+    /**
+     * 鍒嗛〉鏌ヨ
+     * @param page 鍒嗛〉瀵硅薄
+     * @param planSubjectMatter 鎺掍骇璁″垝鏍囩殑鐗�
+     * @return
+     */
+    @Operation(summary = "鍒嗛〉鏌ヨ" , description = "鍒嗛〉鏌ヨ" )
+    @GetMapping("/page" )
+    @PreAuthorize("@pms.hasPermission('business_planSubjectMatter_view')" )
+    public R getPlanSubjectMatterPage(@ParameterObject Page page, @ParameterObject PlanSubjectMatter planSubjectMatter) {
+        LambdaQueryWrapper<PlanSubjectMatter> wrapper = Wrappers.lambdaQuery();
+        return R.ok(planSubjectMatterService.page(page, wrapper));
+    }
+
+
+    /**
+     * 閫氳繃id鏌ヨ鎺掍骇璁″垝鏍囩殑鐗�
+     * @param id id
+     * @return R
+     */
+    @Operation(summary = "閫氳繃id鏌ヨ" , description = "閫氳繃id鏌ヨ" )
+    @GetMapping("/{id}" )
+    @PreAuthorize("@pms.hasPermission('business_planSubjectMatter_view')" )
+    public R getById(@PathVariable("id" ) Long id) {
+        return R.ok(planSubjectMatterService.getById(id));
+    }
+
+    /**
+     * 鏂板鎺掍骇璁″垝鏍囩殑鐗�
+     * @param planSubjectMatter 鎺掍骇璁″垝鏍囩殑鐗�
+     * @return R
+     */
+    @Operation(summary = "鏂板鎺掍骇璁″垝鏍囩殑鐗�" , description = "鏂板鎺掍骇璁″垝鏍囩殑鐗�" )
+    @SysLog("鏂板鎺掍骇璁″垝鏍囩殑鐗�" )
+    @PostMapping
+    @PreAuthorize("@pms.hasPermission('business_planSubjectMatter_add')" )
+    public R save(@RequestBody PlanSubjectMatter planSubjectMatter) {
+        return R.ok(planSubjectMatterService.save(planSubjectMatter));
+    }
+
+    /**
+     * 淇敼鎺掍骇璁″垝鏍囩殑鐗�
+     * @param planSubjectMatter 鎺掍骇璁″垝鏍囩殑鐗�
+     * @return R
+     */
+    @Operation(summary = "淇敼鎺掍骇璁″垝鏍囩殑鐗�" , description = "淇敼鎺掍骇璁″垝鏍囩殑鐗�" )
+    @SysLog("淇敼鎺掍骇璁″垝鏍囩殑鐗�" )
+    @PutMapping
+    @PreAuthorize("@pms.hasPermission('business_planSubjectMatter_edit')" )
+    public R updateById(@RequestBody PlanSubjectMatter planSubjectMatter) {
+        return R.ok(planSubjectMatterService.updateById(planSubjectMatter));
+    }
+
+    /**
+     * 閫氳繃id鍒犻櫎鎺掍骇璁″垝鏍囩殑鐗�
+     * @param ids id鍒楄〃
+     * @return R
+     */
+    @Operation(summary = "閫氳繃id鍒犻櫎鎺掍骇璁″垝鏍囩殑鐗�" , description = "閫氳繃id鍒犻櫎鎺掍骇璁″垝鏍囩殑鐗�" )
+    @SysLog("閫氳繃id鍒犻櫎鎺掍骇璁″垝鏍囩殑鐗�" )
+    @DeleteMapping
+    @PreAuthorize("@pms.hasPermission('business_planSubjectMatter_del')" )
+    public R removeById(@RequestBody Long[] ids) {
+        return R.ok(planSubjectMatterService.removeBatchByIds(CollUtil.toList(ids)));
+    }
+
+
+    /**
+     * 瀵煎嚭excel 琛ㄦ牸
+     * @param planSubjectMatter 鏌ヨ鏉′欢
+   	 * @param ids 瀵煎嚭鎸囧畾ID
+     * @return excel 鏂囦欢娴�
+     */
+    @ResponseExcel
+    @GetMapping("/export")
+    @PreAuthorize("@pms.hasPermission('business_planSubjectMatter_export')" )
+    public List<PlanSubjectMatter> export(PlanSubjectMatter planSubjectMatter,Long[] ids) {
+        return planSubjectMatterService.list(Wrappers.lambdaQuery(planSubjectMatter).in(ArrayUtil.isNotEmpty(ids), PlanSubjectMatter::getId, ids));
+    }
+}
\ No newline at end of file
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/ProductionPlanController.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/ProductionPlanController.java
index 3ed883a..0530d36 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/ProductionPlanController.java
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/ProductionPlanController.java
@@ -7,7 +7,9 @@
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.by4cloud.platformx.business.entity.ContractSubjectMatter;
+import com.by4cloud.platformx.business.entity.PlanSubjectMatter;
 import com.by4cloud.platformx.business.service.ContractSubjectMatterService;
+import com.by4cloud.platformx.business.service.PlanSubjectMatterService;
 import com.by4cloud.platformx.business.utils.ContractNumberGenerator;
 import com.by4cloud.platformx.common.core.util.R;
 import com.by4cloud.platformx.common.data.mybatis.BaseModel;
@@ -44,7 +46,8 @@
 public class ProductionPlanController {
 
     private final  ProductionPlanService productionPlanService;
-    private final ContractSubjectMatterService contractSubjectMatterService;
+    //private final ContractSubjectMatterService contractSubjectMatterService;
+    private final PlanSubjectMatterService planSubjectMatterService;
 
     /**
      * 鍒嗛〉鏌ヨ
@@ -64,10 +67,10 @@
         Page<ProductionPlan> page1 = productionPlanService.page(page, wrapper);
         List<ProductionPlan> list = page1.getRecords();
         for(ProductionPlan plan : list){
-            List<ContractSubjectMatter> metterList = contractSubjectMatterService.list(new LambdaQueryWrapper<ContractSubjectMatter>()
-                    .eq(ContractSubjectMatter::getProductionPlanId,plan.getId())
+            List<PlanSubjectMatter> metterList = planSubjectMatterService.list(new LambdaQueryWrapper<PlanSubjectMatter>()
+                    .eq(PlanSubjectMatter::getPlanId,plan.getId())
             );
-            plan.setContractSubjectMatterList(metterList);
+            plan.setPlanSubjectMatterList(metterList);
         }
         page1.setRecords(list);
         return R.ok(page1);
@@ -99,10 +102,10 @@
         if(productionPlan==null){
             return R.failed("id閿欒锛�");
         }
-        List<ContractSubjectMatter> list = contractSubjectMatterService.list(new LambdaQueryWrapper<ContractSubjectMatter>()
-                .eq(ContractSubjectMatter::getProductionPlanId,productionPlan.getId())
+        List<PlanSubjectMatter> list = planSubjectMatterService.list(new LambdaQueryWrapper<PlanSubjectMatter>()
+                .eq(PlanSubjectMatter::getPlanId,productionPlan.getId())
         );
-        productionPlan.setContractSubjectMatterList(list);
+        productionPlan.setPlanSubjectMatterList(list);
         return R.ok(productionPlan);
     }
 
@@ -124,12 +127,11 @@
         productionPlan.setProductionPlanNo("p-"+ContractNumberGenerator.generateContractNumber());
         productionPlanService.save(productionPlan);
 
-        if(productionPlan.getContractSubjectMatterList()!=null){
-            for(ContractSubjectMatter matter1 : productionPlan.getContractSubjectMatterList()){
-                matter1.setProductionPlanId(productionPlan.getId());
-                matter1.setProductionPlanName(productionPlan.getProductionPlanName());
+        if(productionPlan.getPlanSubjectMatterList()!=null){
+            for(PlanSubjectMatter matter1 : productionPlan.getPlanSubjectMatterList()){
+                matter1.setPlanId(productionPlan.getId());
             }
-            contractSubjectMatterService.saveBatch(productionPlan.getContractSubjectMatterList());
+            planSubjectMatterService.saveBatch(productionPlan.getPlanSubjectMatterList());
         }
 
         return R.ok(true);
@@ -146,8 +148,8 @@
     @PreAuthorize("@pms.hasPermission('business_productionPlan_edit')" )
     public R updateById(@RequestBody ProductionPlan productionPlan) {
 
-        List<ContractSubjectMatter> list = contractSubjectMatterService.list(new LambdaQueryWrapper<ContractSubjectMatter>()
-                .eq(ContractSubjectMatter::getProductionPlanId,productionPlan.getId())
+        List<PlanSubjectMatter> list = planSubjectMatterService.list(new LambdaQueryWrapper<PlanSubjectMatter>()
+                .eq(PlanSubjectMatter::getPlanId,productionPlan.getId())
         );
         List<Long> idsO = new ArrayList<>();
         if(list!=null){
@@ -156,21 +158,20 @@
             }
         }
 
-        if(productionPlan.getContractSubjectMatterList()!=null){
+        if(productionPlan.getPlanSubjectMatterList()!=null){
             List<Long> idsN = new ArrayList<>();
-            for(ContractSubjectMatter matter : productionPlan.getContractSubjectMatterList()){
+            for(PlanSubjectMatter matter : productionPlan.getPlanSubjectMatterList()){
                 if(matter.getId()==null){
-                    matter.setProductionPlanId(productionPlan.getId());
-                    matter.setProductionPlanName(productionPlan.getProductionPlanName());
+                    matter.setPlanId(productionPlan.getId());
                 }else{
                     idsN.add(matter.getId());
                 }
             }
-            contractSubjectMatterService.saveOrUpdateBatch(productionPlan.getContractSubjectMatterList());
+            planSubjectMatterService.saveOrUpdateBatch(productionPlan.getPlanSubjectMatterList());
             if(!idsO.isEmpty()) {
                 for (Long id : idsO) {
                     if (!idsN.contains(id)) {
-                        contractSubjectMatterService.removeById(id);
+                        planSubjectMatterService.removeById(id);
                     }
                 }
             }
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/mapper/PlanSubjectMatterMapper.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/mapper/PlanSubjectMatterMapper.java
new file mode 100644
index 0000000..786f4e7
--- /dev/null
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/mapper/PlanSubjectMatterMapper.java
@@ -0,0 +1,11 @@
+package com.by4cloud.platformx.business.mapper;
+
+import com.by4cloud.platformx.common.data.datascope.PlatformxBaseMapper;
+import com.by4cloud.platformx.business.entity.PlanSubjectMatter;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface PlanSubjectMatterMapper extends PlatformxBaseMapper<PlanSubjectMatter> {
+
+
+}
\ No newline at end of file
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/PlanSubjectMatterService.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/PlanSubjectMatterService.java
new file mode 100644
index 0000000..70b5225
--- /dev/null
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/PlanSubjectMatterService.java
@@ -0,0 +1,8 @@
+package com.by4cloud.platformx.business.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.by4cloud.platformx.business.entity.PlanSubjectMatter;
+
+public interface PlanSubjectMatterService extends IService<PlanSubjectMatter> {
+
+}
\ No newline at end of file
diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/PlanSubjectMatterServiceImpl.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/PlanSubjectMatterServiceImpl.java
new file mode 100644
index 0000000..79278a0
--- /dev/null
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/PlanSubjectMatterServiceImpl.java
@@ -0,0 +1,16 @@
+package com.by4cloud.platformx.business.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.by4cloud.platformx.business.entity.PlanSubjectMatter;
+import com.by4cloud.platformx.business.mapper.PlanSubjectMatterMapper;
+import com.by4cloud.platformx.business.service.PlanSubjectMatterService;
+import org.springframework.stereotype.Service;
+/**
+ * 鎺掍骇璁″垝鏍囩殑鐗�
+ *
+ * @author platformx
+ * @date 2026-05-14 10:55:14
+ */
+@Service
+public class PlanSubjectMatterServiceImpl extends ServiceImpl<PlanSubjectMatterMapper, PlanSubjectMatter> implements PlanSubjectMatterService {
+}
\ No newline at end of file
diff --git a/platformx-business-finance-biz/src/main/resources/mapper/PlanSubjectMatterMapper.xml b/platformx-business-finance-biz/src/main/resources/mapper/PlanSubjectMatterMapper.xml
new file mode 100644
index 0000000..b91d3a7
--- /dev/null
+++ b/platformx-business-finance-biz/src/main/resources/mapper/PlanSubjectMatterMapper.xml
@@ -0,0 +1,19 @@
+<?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.by4cloud.platformx.business.mapper.PlanSubjectMatterMapper">
+
+  <resultMap id="planSubjectMatterMap" type="com.by4cloud.platformx.business.entity.PlanSubjectMatter">
+        <id property="id" column="id"/>
+        <result property="productId" column="product_id"/>
+        <result property="productName" column="product_name"/>
+        <result property="erpCode" column="erp_code"/>
+        <result property="productNum" column="product_num"/>
+        <result property="compId" column="comp_id"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="delFlag" column="del_flag"/>
+  </resultMap>
+</mapper>
\ No newline at end of file

--
Gitblit v1.9.1