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; 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; } platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/PlanSubjectMatterController.java
New file @@ -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)); } } 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); } } } platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/mapper/PlanSubjectMatterMapper.java
New file @@ -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> { } platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/PlanSubjectMatterService.java
New file @@ -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> { } platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/service/impl/PlanSubjectMatterServiceImpl.java
New file @@ -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 { } platformx-business-finance-biz/src/main/resources/mapper/PlanSubjectMatterMapper.xml
New file @@ -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>