计划管理相关功能实现

This commit is contained in:
潘荣晟
2026-01-19 17:31:52 +08:00
parent bee606926a
commit 6602fcd6e3
36 changed files with 1559 additions and 7 deletions

View File

@@ -0,0 +1,139 @@
package com.zt.plat.module.base.controller.admin.erpmonthproductiveplancheck;
import com.zt.plat.module.base.controller.admin.erpmonthproductiveplancheck.vo.ErpMonthProductivePlanCheckDetailRespVO;
import com.zt.plat.module.base.controller.admin.erpmonthproductiveplancheck.vo.ErpMonthProductivePlanCheckPageReqVO;
import com.zt.plat.module.base.controller.admin.erpmonthproductiveplancheck.vo.ErpMonthProductivePlanCheckRespVO;
import com.zt.plat.module.base.controller.admin.erpmonthproductiveplancheck.vo.ErpMonthProductivePlanCheckSaveReqVO;
import com.zt.plat.module.base.dal.dataobject.erpmonthproductiveplancheck.ErpMonthProductivePlanCheckDO;
import com.zt.plat.module.base.service.erpmonthproductiveplancheck.ErpMonthProductivePlanCheckService;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import com.zt.plat.framework.business.interceptor.BusinessControllerMarker;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.constraints.*;
import jakarta.validation.*;
import jakarta.servlet.http.*;
import java.util.*;
import java.io.IOException;
import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO;
import com.zt.plat.framework.common.pojo.PageParam;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.framework.common.util.object.BeanUtils;
import static com.zt.plat.framework.common.pojo.CommonResult.success;
import com.zt.plat.framework.excel.core.util.ExcelUtils;
import com.zt.plat.framework.apilog.core.annotation.ApiAccessLog;
import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.*;
@Tag(name = "管理后台 - ERP月度产品计划核对")
@RestController
@RequestMapping("/base/erp-month-productive-plan-check")
@Validated
public class ErpMonthProductivePlanCheckController implements BusinessControllerMarker {
@Resource
private ErpMonthProductivePlanCheckService erpMonthProductivePlanCheckService;
@PostMapping("/create")
@Operation(summary = "创建ERP月度产品计划核对")
@PreAuthorize("@ss.hasPermission('base:erp-month-productive-plan-check:create')")
public CommonResult<ErpMonthProductivePlanCheckRespVO> createErpMonthProductivePlanCheck(@Valid @RequestBody ErpMonthProductivePlanCheckSaveReqVO createReqVO) {
return success(erpMonthProductivePlanCheckService.createErpMonthProductivePlanCheck(createReqVO));
}
@PostMapping("/create-batch")
@Operation(summary = "创建ERP月度产品计划核对")
@PreAuthorize("@ss.hasPermission('base:erp-month-productive-plan-check:create')")
public CommonResult<?> createBatchErpMonthProductivePlanCheck(@Valid @RequestBody List<ErpMonthProductivePlanCheckSaveReqVO> createReqVOList) {
erpMonthProductivePlanCheckService.createBatchErpMonthProductivePlanCheck(createReqVOList);
return success(true);
}
@PutMapping("/update")
@Operation(summary = "更新ERP月度产品计划核对")
@PreAuthorize("@ss.hasPermission('base:erp-month-productive-plan-check:update')")
public CommonResult<Boolean> updateErpMonthProductivePlanCheck(@Valid @RequestBody ErpMonthProductivePlanCheckSaveReqVO updateReqVO) {
erpMonthProductivePlanCheckService.updateErpMonthProductivePlanCheck(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除ERP月度产品计划核对")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('base:erp-month-productive-plan-check:delete')")
public CommonResult<Boolean> deleteErpMonthProductivePlanCheck(@RequestParam("id") Long id) {
erpMonthProductivePlanCheckService.deleteErpMonthProductivePlanCheck(id);
return success(true);
}
@DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除ERP月度产品计划核对")
@PreAuthorize("@ss.hasPermission('base:erp-month-productive-plan-check:delete')")
public CommonResult<Boolean> deleteErpMonthProductivePlanCheckList(@RequestBody BatchDeleteReqVO req) {
erpMonthProductivePlanCheckService.deleteErpMonthProductivePlanCheckListByIds(req.getIds());
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得ERP月度产品计划核对")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('base:erp-month-productive-plan-check:query')")
public CommonResult<ErpMonthProductivePlanCheckRespVO> getErpMonthProductivePlanCheck(@RequestParam("id") Long id) {
ErpMonthProductivePlanCheckDO erpMonthProductivePlanCheck = erpMonthProductivePlanCheckService.getErpMonthProductivePlanCheck(id);
ErpMonthProductivePlanCheckRespVO respVO = BeanUtils.toBean(erpMonthProductivePlanCheck, ErpMonthProductivePlanCheckRespVO.class);
if (respVO != null) {
respVO.setDetails(erpMonthProductivePlanCheckService.getErpMonthProductivePlanCheckDetail(id));
}
return success(respVO);
}
@GetMapping("/page")
@Operation(summary = "获得ERP月度产品计划核对分页")
@PreAuthorize("@ss.hasPermission('base:erp-month-productive-plan-check:query')")
public CommonResult<PageResult<ErpMonthProductivePlanCheckRespVO>> getErpMonthProductivePlanCheckPage(@Valid ErpMonthProductivePlanCheckPageReqVO pageReqVO) {
PageResult<ErpMonthProductivePlanCheckDO> pageResult = erpMonthProductivePlanCheckService.getErpMonthProductivePlanCheckPage(pageReqVO);
PageResult<ErpMonthProductivePlanCheckRespVO> result = BeanUtils.toBean(pageResult, ErpMonthProductivePlanCheckRespVO.class);
if (result != null && result.getList() != null && !result.getList().isEmpty()){
result.getList().forEach(erpMonthProductivePlanCheckRespVO
-> erpMonthProductivePlanCheckRespVO.setDetails(erpMonthProductivePlanCheckService.getErpMonthProductivePlanCheckDetail(erpMonthProductivePlanCheckRespVO.getId())));
}
return success(result);
}
@GetMapping("/export-excel")
@Operation(summary = "导出ERP月度产品计划核对 Excel")
@PreAuthorize("@ss.hasPermission('base:erp-month-productive-plan-check:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportErpMonthProductivePlanCheckExcel(@Valid ErpMonthProductivePlanCheckPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<ErpMonthProductivePlanCheckDO> list = erpMonthProductivePlanCheckService.getErpMonthProductivePlanCheckPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "ERP月度产品计划核对.xls", "数据", ErpMonthProductivePlanCheckRespVO.class,
BeanUtils.toBean(list, ErpMonthProductivePlanCheckRespVO.class));
}
//根据id查询明细详情
@GetMapping("/get-detail")
@Operation(summary = "获得ERP月度产品计划核对明细详情")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('base:erp-month-productive-plan-check:query')")
public CommonResult<List<ErpMonthProductivePlanCheckDetailRespVO>> getErpMonthProductivePlanCheckDetail(@RequestParam("id") Long id) {
return success(erpMonthProductivePlanCheckService.getErpMonthProductivePlanCheckDetail(id));
}
}

View File

@@ -0,0 +1,112 @@
package com.zt.plat.module.base.controller.admin.erpmonthproductiveplancheck;
import com.zt.plat.module.base.controller.admin.erpmonthproductiveplancheck.vo.ErpMonthProductivePlanCheckDetailPageReqVO;
import com.zt.plat.module.base.controller.admin.erpmonthproductiveplancheck.vo.ErpMonthProductivePlanCheckDetailRespVO;
import com.zt.plat.module.base.controller.admin.erpmonthproductiveplancheck.vo.ErpMonthProductivePlanCheckDetailSaveReqVO;
import com.zt.plat.module.base.dal.dataobject.erpmonthproductiveplancheck.ErpMonthProductivePlanCheckDetailDO;
import com.zt.plat.module.base.service.erpmonthproductiveplancheck.ErpMonthProductivePlanCheckDetailService;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import com.zt.plat.framework.business.interceptor.BusinessControllerMarker;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.constraints.*;
import jakarta.validation.*;
import jakarta.servlet.http.*;
import java.util.*;
import java.io.IOException;
import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO;
import com.zt.plat.framework.common.pojo.PageParam;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.framework.common.util.object.BeanUtils;
import static com.zt.plat.framework.common.pojo.CommonResult.success;
import com.zt.plat.framework.excel.core.util.ExcelUtils;
import com.zt.plat.framework.apilog.core.annotation.ApiAccessLog;
import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.*;
@Tag(name = "管理后台 - ERP月度产品计划核对明细")
@RestController
@RequestMapping("/base/erp-month-productive-plan-check-detail")
@Validated
public class ErpMonthProductivePlanCheckDetailController implements BusinessControllerMarker {
@Resource
private ErpMonthProductivePlanCheckDetailService erpMonthProductivePlanCheckDetailService;
@PostMapping("/create")
@Operation(summary = "创建ERP月度产品计划核对明细")
@PreAuthorize("@ss.hasPermission('base:erp-month-productive-plan-check-detail:create')")
public CommonResult<ErpMonthProductivePlanCheckDetailRespVO> createErpMonthProductivePlanCheckDetail(@Valid @RequestBody ErpMonthProductivePlanCheckDetailSaveReqVO createReqVO) {
return success(erpMonthProductivePlanCheckDetailService.createErpMonthProductivePlanCheckDetail(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新ERP月度产品计划核对明细")
@PreAuthorize("@ss.hasPermission('base:erp-month-productive-plan-check-detail:update')")
public CommonResult<Boolean> updateErpMonthProductivePlanCheckDetail(@Valid @RequestBody ErpMonthProductivePlanCheckDetailSaveReqVO updateReqVO) {
erpMonthProductivePlanCheckDetailService.updateErpMonthProductivePlanCheckDetail(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除ERP月度产品计划核对明细")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('base:erp-month-productive-plan-check-detail:delete')")
public CommonResult<Boolean> deleteErpMonthProductivePlanCheckDetail(@RequestParam("id") Long id) {
erpMonthProductivePlanCheckDetailService.deleteErpMonthProductivePlanCheckDetail(id);
return success(true);
}
@DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除ERP月度产品计划核对明细")
@PreAuthorize("@ss.hasPermission('base:erp-month-productive-plan-check-detail:delete')")
public CommonResult<Boolean> deleteErpMonthProductivePlanCheckDetailList(@RequestBody BatchDeleteReqVO req) {
erpMonthProductivePlanCheckDetailService.deleteErpMonthProductivePlanCheckDetailListByIds(req.getIds());
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得ERP月度产品计划核对明细")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('base:erp-month-productive-plan-check-detail:query')")
public CommonResult<ErpMonthProductivePlanCheckDetailRespVO> getErpMonthProductivePlanCheckDetail(@RequestParam("id") Long id) {
ErpMonthProductivePlanCheckDetailDO erpMonthProductivePlanCheckDetail = erpMonthProductivePlanCheckDetailService.getErpMonthProductivePlanCheckDetail(id);
return success(BeanUtils.toBean(erpMonthProductivePlanCheckDetail, ErpMonthProductivePlanCheckDetailRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得ERP月度产品计划核对明细分页")
@PreAuthorize("@ss.hasPermission('base:erp-month-productive-plan-check-detail:query')")
public CommonResult<PageResult<ErpMonthProductivePlanCheckDetailRespVO>> getErpMonthProductivePlanCheckDetailPage(@Valid ErpMonthProductivePlanCheckDetailPageReqVO pageReqVO) {
PageResult<ErpMonthProductivePlanCheckDetailDO> pageResult = erpMonthProductivePlanCheckDetailService.getErpMonthProductivePlanCheckDetailPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, ErpMonthProductivePlanCheckDetailRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出ERP月度产品计划核对明细 Excel")
@PreAuthorize("@ss.hasPermission('base:erp-month-productive-plan-check-detail:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportErpMonthProductivePlanCheckDetailExcel(@Valid ErpMonthProductivePlanCheckDetailPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<ErpMonthProductivePlanCheckDetailDO> list = erpMonthProductivePlanCheckDetailService.getErpMonthProductivePlanCheckDetailPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "ERP月度产品计划核对明细.xls", "数据", ErpMonthProductivePlanCheckDetailRespVO.class,
BeanUtils.toBean(list, ErpMonthProductivePlanCheckDetailRespVO.class));
}
}

View File

@@ -0,0 +1,34 @@
package com.zt.plat.module.base.controller.admin.erpmonthproductiveplancheck.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import com.zt.plat.framework.common.pojo.PageParam;
import java.math.BigDecimal;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - ERP月度产品计划核对明细分页 Request VO")
@Data
public class ErpMonthProductivePlanCheckDetailPageReqVO extends PageParam {
@Schema(description = "日期格式YYYY-MM-DD")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private String[] date;
@Schema(description = "排序")
private Integer sort;
@Schema(description = "")
private BigDecimal value;
@Schema(description = "主数据ID关联主表ID", example = "3745")
private Long mainId;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@@ -0,0 +1,40 @@
package com.zt.plat.module.base.controller.admin.erpmonthproductiveplancheck.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.math.BigDecimal;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - ERP月度产品计划核对明细 Response VO")
@Data
@ExcelIgnoreUnannotated
public class ErpMonthProductivePlanCheckDetailRespVO {
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "14111")
@ExcelProperty("主键ID")
private Long id;
@Schema(description = "日期格式YYYY-MM-DD")
@ExcelProperty("日期格式YYYY-MM-DD")
private String date;
@Schema(description = "排序")
@ExcelProperty("排序")
private Integer sort;
@Schema(description = "")
@ExcelProperty("")
private BigDecimal value;
@Schema(description = "主数据ID关联主表ID", example = "3745")
@ExcelProperty("主数据ID关联主表ID")
private Long mainId;
@Schema(description = "创建时间")
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@@ -0,0 +1,28 @@
package com.zt.plat.module.base.controller.admin.erpmonthproductiveplancheck.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
import java.math.BigDecimal;
@Schema(description = "管理后台 - ERP月度产品计划核对明细新增/修改 Request VO")
@Data
public class ErpMonthProductivePlanCheckDetailSaveReqVO {
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "14111")
private Long id;
@Schema(description = "日期格式YYYY-MM-DD")
private String date;
@Schema(description = "排序")
private Integer sort;
@Schema(description = "")
private BigDecimal value;
@Schema(description = "主数据ID关联主表ID", example = "3745")
private Long mainId;
}

View File

@@ -0,0 +1,33 @@
package com.zt.plat.module.base.controller.admin.erpmonthproductiveplancheck.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import com.zt.plat.framework.common.pojo.PageParam;
import java.math.BigDecimal;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - ERP月度产品计划核对分页 Request VO")
@Data
public class ErpMonthProductivePlanCheckPageReqVO extends PageParam {
@Schema(description = "产品名")
private String product;
@Schema(description = "年度")
private String year;
@Schema(description = "月份")
private String month;
@Schema(description = "月计划量")
private BigDecimal monthPlan;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@@ -0,0 +1,43 @@
package com.zt.plat.module.base.controller.admin.erpmonthproductiveplancheck.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.math.BigDecimal;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - ERP月度产品计划核对 Response VO")
@Data
@ExcelIgnoreUnannotated
public class ErpMonthProductivePlanCheckRespVO {
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "19081")
@ExcelProperty("主键ID")
private Long id;
@Schema(description = "产品名")
@ExcelProperty("产品名")
private String product;
@Schema(description = "年度")
@ExcelProperty("年度")
private String year;
@Schema(description = "月份")
@ExcelProperty("月份")
private String month;
@Schema(description = "月计划量")
@ExcelProperty("月计划量")
private BigDecimal monthPlan;
@Schema(description = "创建时间")
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@Schema(description = "详情")
@ExcelProperty("详情")
private List<ErpMonthProductivePlanCheckDetailRespVO> details;
}

View File

@@ -0,0 +1,31 @@
package com.zt.plat.module.base.controller.admin.erpmonthproductiveplancheck.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
import java.math.BigDecimal;
@Schema(description = "管理后台 - ERP月度产品计划核对新增/修改 Request VO")
@Data
public class ErpMonthProductivePlanCheckSaveReqVO {
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "19081")
private Long id;
@Schema(description = "产品名")
private String product;
@Schema(description = "年度")
private String year;
@Schema(description = "月份")
private String month;
@Schema(description = "月计划量")
private BigDecimal monthPlan;
@Schema(description = "月计划明细")
private List<ErpMonthProductivePlanCheckDetailSaveReqVO> details;
}

View File

@@ -113,7 +113,7 @@ public class PlanDateController implements BusinessControllerMarker {
@GetMapping("/tree/list-all")
@Operation(summary = "查询所有计划数据(树形结构)")
@PreAuthorize("@ss.hasPermission('base:plan-date:query')")
public List<PlanDateRespVO> listAllPlanDateTree() {
return planDateService.listPlanDateTree();
public CommonResult<List<PlanDateRespVO>> listAllPlanDateTree() {
return success(planDateService.listPlanDateTree());
}
}

View File

@@ -0,0 +1,59 @@
package com.zt.plat.module.base.controller.admin.plandate;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.module.base.controller.admin.plandate.vo.PlanDateRespVO;
import com.zt.plat.module.base.controller.admin.plandate.vo.PlanOrderSaveReqVO;
import com.zt.plat.module.base.service.plandate.PlanOrderService;
import com.zt.plat.module.contractorder.api.dto.order.OrderAndPlanDataReqDTO;
import com.zt.plat.module.contractorder.api.dto.order.OrderDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.apache.ibatis.annotations.Delete;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import static com.zt.plat.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - 计划数据与订单绑定")
@RestController
@RequestMapping("/base/plan-order")
@Validated
public class PlanOrderController {
@Resource
private PlanOrderService planOrderService;
//绑定订单
@PostMapping("/bind-order")
@Operation(summary = "计划与订单绑定")
@PreAuthorize("@ss.hasAnyPermissions({'base:plan-date:tree:list-all:query'})")
public CommonResult<?> bindOrder(@RequestBody PlanOrderSaveReqVO reqVO) {
return success( planOrderService.bindOrder(reqVO));
}
//解绑订单
@DeleteMapping("/release-order")
@Operation(summary = "计划与订单解绑")
@PreAuthorize("@ss.hasAnyPermissions({'base:plan-date:tree:list-all:releaseOrder'})")
public CommonResult<?> unbindOrder(@RequestParam("planId") String planId,@RequestParam("orderNumber") String orderNumber) {
planOrderService.unbindOrder(planId, orderNumber);
return success(true);
}
//根据订单号获取已绑定的订单
@GetMapping("/get-bound-order")
@Operation(summary = "根据计划ID获取已绑定的订单")
@PreAuthorize("@ss.hasAnyPermissions({'base:plan-date:tree:list-all:query'})")
public CommonResult<?> getBoundOrder(@RequestParam("planId") String planId) {
return success(planOrderService.getBoundOrder(planId));
}
//根据计划和订单的参数查询相关的订单
@PostMapping("/query-order-plan-data")
@Operation(summary = "根据计划和订单的参数查询相关的订单")
@PreAuthorize("@ss.hasAnyPermissions({'base:plan-date:tree:list-all:query'})")
public CommonResult<PageResult<OrderDTO>> queryOrder(@RequestBody OrderAndPlanDataReqDTO reqVO) {
return success(planOrderService.queryOrderAndPlanData(reqVO));
}
}

View File

@@ -0,0 +1,34 @@
package com.zt.plat.module.base.controller.admin.plandate.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(description = "计划数据与订单绑定响应VO")
public class PlanOrderRspVO {
/**
* 编号
*/
@Schema(description = "编号")
private Long id;
/**
* 订单编号
*/
@Schema(description = "订单号")
private String orderNumber;
/**
* 订单类型
*/
@Schema(description = "订单类型")
private String orderType;
/**
* 计划ID
*/
@Schema(description = "计划ID")
private Long planId;
/**
* 订单状态
*/
@Schema(description = "订单状态")
private String orderStatus;
}

View File

@@ -0,0 +1,35 @@
package com.zt.plat.module.base.controller.admin.plandate.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(description = "保存计划数据与订单绑定的请求VO")
public class PlanOrderSaveReqVO {
/**
* 编号
*/
@Schema(description = "编号")
private Long id;
/**
* 订单编号
*/
@Schema(description = "订单号")
private String orderNumber;
/**
* 订单类型
*/
@Schema(description = "订单类型")
private String orderType;
/**
* 订单ID
*/
@Schema(description = "订单ID")
private Long orderId;
/**
* 计划ID
*/
@Schema(description = "计划ID")
private Long planId;
}

View File

@@ -0,0 +1,31 @@
package com.zt.plat.module.base.dal.dao.erpmonthproductiveplancheck;
import java.util.*;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.module.base.controller.admin.erpmonthproductiveplancheck.vo.ErpMonthProductivePlanCheckDetailPageReqVO;
import com.zt.plat.module.base.dal.dataobject.erpmonthproductiveplancheck.ErpMonthProductivePlanCheckDetailDO;
import org.apache.ibatis.annotations.Mapper;
/**
* ERP月度产品计划核对明细 Mapper
*
* @author 后台管理-1
*/
@Mapper
public interface ErpMonthProductivePlanCheckDetailMapper extends BaseMapperX<ErpMonthProductivePlanCheckDetailDO> {
default PageResult<ErpMonthProductivePlanCheckDetailDO> selectPage(ErpMonthProductivePlanCheckDetailPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<ErpMonthProductivePlanCheckDetailDO>()
.betweenIfPresent(ErpMonthProductivePlanCheckDetailDO::getDate, reqVO.getDate())
.eqIfPresent(ErpMonthProductivePlanCheckDetailDO::getSort, reqVO.getSort())
.eqIfPresent(ErpMonthProductivePlanCheckDetailDO::getValue, reqVO.getValue())
.eqIfPresent(ErpMonthProductivePlanCheckDetailDO::getMainId, reqVO.getMainId())
.betweenIfPresent(ErpMonthProductivePlanCheckDetailDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(ErpMonthProductivePlanCheckDetailDO::getId));
}
}

View File

@@ -0,0 +1,32 @@
package com.zt.plat.module.base.dal.dao.erpmonthproductiveplancheck;
import java.util.*;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.module.base.controller.admin.erpmonthproductiveplancheck.vo.ErpMonthProductivePlanCheckPageReqVO;
import com.zt.plat.module.base.dal.dataobject.erpmonthproductiveplancheck.ErpMonthProductivePlanCheckDO;
import org.apache.ibatis.annotations.Mapper;
/**
* ERP月度产品计划核对 Mapper
*
* @author 后台管理-1
*/
@Mapper
public interface ErpMonthProductivePlanCheckMapper extends BaseMapperX<ErpMonthProductivePlanCheckDO> {
default PageResult<ErpMonthProductivePlanCheckDO> selectPage(ErpMonthProductivePlanCheckPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<ErpMonthProductivePlanCheckDO>()
.eqIfPresent(ErpMonthProductivePlanCheckDO::getProduct, reqVO.getProduct())
.eqIfPresent(ErpMonthProductivePlanCheckDO::getYear, reqVO.getYear())
.eqIfPresent(ErpMonthProductivePlanCheckDO::getMonth, reqVO.getMonth())
.eqIfPresent(ErpMonthProductivePlanCheckDO::getMonthPlan, reqVO.getMonthPlan())
.betweenIfPresent(ErpMonthProductivePlanCheckDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(ErpMonthProductivePlanCheckDO::getId));
}
}

View File

@@ -0,0 +1,9 @@
package com.zt.plat.module.base.dal.dao.plandate;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.module.base.dal.dataobject.plandate.PlanOrderDO;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface PlanOrderMapper extends BaseMapperX<PlanOrderDO> {
}

View File

@@ -0,0 +1,56 @@
package com.zt.plat.module.base.dal.dataobject.erpmonthproductiveplancheck;
import lombok.*;
import java.util.*;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import com.zt.plat.framework.mybatis.core.dataobject.BusinessBaseDO;
/**
* ERP月度产品计划核对 DO
*
* @author 后台管理-1
*/
@TableName("bes_erp_mnt_pdtv_pln_chk")
@KeySequence("bes_erp_mnt_pdtv_pln_chk_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
/**
* 支持业务基类继承isBusiness=true 时继承 BusinessBaseDO否则继承 BaseDO
*/
public class ErpMonthProductivePlanCheckDO extends BusinessBaseDO {
/**
* 主键ID
*/
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/**
* 产品名
*/
@TableField("PDT")
private String product;
/**
* 年度
*/
@TableField("YR")
private String year;
/**
* 月份
*/
@TableField("MNT")
private String month;
/**
* 月计划量
*/
@TableField("MNT_PLN")
private BigDecimal monthPlan;
}

View File

@@ -0,0 +1,56 @@
package com.zt.plat.module.base.dal.dataobject.erpmonthproductiveplancheck;
import lombok.*;
import java.util.*;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import com.zt.plat.framework.mybatis.core.dataobject.BusinessBaseDO;
/**
* ERP月度产品计划核对明细 DO
*
* @author 后台管理-1
*/
@TableName("bes_erp_mnt_pdtv_pln_chk_dtl")
@KeySequence("bes_erp_mnt_pdtv_pln_chk_dtl_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
/**
* 支持业务基类继承isBusiness=true 时继承 BusinessBaseDO否则继承 BaseDO
*/
public class ErpMonthProductivePlanCheckDetailDO extends BusinessBaseDO {
/**
* 主键ID
*/
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/**
* 日期格式YYYY-MM-DD
*/
@TableField("DT")
private String date;
/**
* 排序
*/
@TableField("SRT")
private Integer sort;
/**
* 值
*/
@TableField("VAL")
private BigDecimal value;
/**
* 主数据ID关联主表ID
*/
@TableField("MAIN_ID")
private Long mainId;
}

View File

@@ -0,0 +1,51 @@
package com.zt.plat.module.base.dal.dataobject.plandate;
import com.baomidou.mybatisplus.annotation.*;
import com.zt.plat.framework.mybatis.core.dataobject.BusinessBaseDO;
import lombok.*;
/**
* 计划订单 DO
*
* @author 后台管理-1
*/
@TableName("bse_pln_ord_corr")
@KeySequence("bse_pln_ord_corr_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
/**
* 支持业务基类继承isBusiness=true 时继承 BusinessBaseDO否则继承 BaseDO
*/
public class PlanOrderDO extends BusinessBaseDO {
/**
* 编号
*/
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/**
* 订单编号
*/
@TableField("ORD_NUM")
private String orderNumber;
/**
* 订单类型
*/
@TableField("ORD_ID")
private Long orderId;
/**
* 订单类型
*/
@TableField("ORD_TP")
private String orderType;
/**
* 计划ID
*/
@TableField("PLN_ID")
private Long planId;
}

View File

@@ -0,0 +1,81 @@
package com.zt.plat.module.base.service.erpmonthproductiveplancheck;
import java.util.*;
import com.zt.plat.module.base.controller.admin.erpmonthproductiveplancheck.vo.ErpMonthProductivePlanCheckDetailPageReqVO;
import com.zt.plat.module.base.controller.admin.erpmonthproductiveplancheck.vo.ErpMonthProductivePlanCheckDetailRespVO;
import com.zt.plat.module.base.controller.admin.erpmonthproductiveplancheck.vo.ErpMonthProductivePlanCheckDetailSaveReqVO;
import com.zt.plat.module.base.dal.dataobject.erpmonthproductiveplancheck.ErpMonthProductivePlanCheckDetailDO;
import jakarta.validation.*;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.common.pojo.PageParam;
/**
* ERP月度产品计划核对明细 Service 接口
*
* @author 后台管理-1
*/
public interface ErpMonthProductivePlanCheckDetailService {
/**
* 创建ERP月度产品计划核对明细
*
* @param createReqVO 创建信息
* @return 编号
*/
ErpMonthProductivePlanCheckDetailRespVO createErpMonthProductivePlanCheckDetail(@Valid ErpMonthProductivePlanCheckDetailSaveReqVO createReqVO);
/**
* 创建ERP月度产品计划核对明细
*
* @param createReqVOS 创建信息
* @return 编号
*/
List<ErpMonthProductivePlanCheckDetailRespVO> createErpMonthProductivePlanCheckDetail(@Valid List<ErpMonthProductivePlanCheckDetailSaveReqVO> createReqVOS);
/**
* 更新ERP月度产品计划核对明细
*
* @param updateReqVO 更新信息
*/
void updateErpMonthProductivePlanCheckDetail(@Valid ErpMonthProductivePlanCheckDetailSaveReqVO updateReqVO);
/**
* 删除ERP月度产品计划核对明细
*
* @param id 编号
*/
void deleteErpMonthProductivePlanCheckDetail(Long id);
/**
* 批量删除ERP月度产品计划核对明细
*
* @param ids 编号
*/
void deleteErpMonthProductivePlanCheckDetailListByIds(List<Long> ids);
/**
* 获得ERP月度产品计划核对明细
*
* @param id 编号
* @return ERP月度产品计划核对明细
*/
ErpMonthProductivePlanCheckDetailDO getErpMonthProductivePlanCheckDetail(Long id);
/**
* 获得ERP月度产品计划核对明细分页
*
* @param pageReqVO 分页查询
* @return ERP月度产品计划核对明细分页
*/
PageResult<ErpMonthProductivePlanCheckDetailDO> getErpMonthProductivePlanCheckDetailPage(ErpMonthProductivePlanCheckDetailPageReqVO pageReqVO);
/**
* 根据mainId获取到ERP月度产品计划核对明细
*
* @param mainId 分页查询
* @return ERP月度产品计划核对明细
*/
List<ErpMonthProductivePlanCheckDetailRespVO> getErpMonthProductivePlanCheckDetailListByMainId(Long mainId);
}

View File

@@ -0,0 +1,106 @@
package com.zt.plat.module.base.service.erpmonthproductiveplancheck;
import cn.hutool.core.collection.CollUtil;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.common.util.object.BeanUtils;
import com.zt.plat.module.base.controller.admin.erpmonthproductiveplancheck.vo.ErpMonthProductivePlanCheckDetailPageReqVO;
import com.zt.plat.module.base.controller.admin.erpmonthproductiveplancheck.vo.ErpMonthProductivePlanCheckDetailRespVO;
import com.zt.plat.module.base.controller.admin.erpmonthproductiveplancheck.vo.ErpMonthProductivePlanCheckDetailSaveReqVO;
import com.zt.plat.module.base.dal.dao.erpmonthproductiveplancheck.ErpMonthProductivePlanCheckDetailMapper;
import com.zt.plat.module.base.dal.dataobject.erpmonthproductiveplancheck.ErpMonthProductivePlanCheckDetailDO;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import java.util.List;
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.zt.plat.module.erpmonthproductiveplancheck.ErrorCodeConstants.ERP_MONTH_PRODUCTIVE_PLAN_CHECK_DETAIL_NOT_EXISTS;
/**
* ERP月度产品计划核对明细 Service 实现类
*
* @author 后台管理-1
*/
@Service
@Validated
public class ErpMonthProductivePlanCheckDetailServiceImpl implements ErpMonthProductivePlanCheckDetailService {
@Resource
private ErpMonthProductivePlanCheckDetailMapper erpMonthProductivePlanCheckDetailMapper;
@Override
public ErpMonthProductivePlanCheckDetailRespVO createErpMonthProductivePlanCheckDetail(ErpMonthProductivePlanCheckDetailSaveReqVO createReqVO) {
// 插入
ErpMonthProductivePlanCheckDetailDO erpMonthProductivePlanCheckDetail = BeanUtils.toBean(createReqVO, ErpMonthProductivePlanCheckDetailDO.class);
erpMonthProductivePlanCheckDetailMapper.insert(erpMonthProductivePlanCheckDetail);
// 返回
return BeanUtils.toBean(erpMonthProductivePlanCheckDetail, ErpMonthProductivePlanCheckDetailRespVO.class);
}
@Override
public List<ErpMonthProductivePlanCheckDetailRespVO> createErpMonthProductivePlanCheckDetail(List<ErpMonthProductivePlanCheckDetailSaveReqVO> createReqVOS) {
if (CollUtil.isEmpty(createReqVOS)) {
return List.of();
}
List<ErpMonthProductivePlanCheckDetailDO> erpMonthProductivePlanCheckDetails = BeanUtils.toBean(createReqVOS, ErpMonthProductivePlanCheckDetailDO.class);
erpMonthProductivePlanCheckDetailMapper.insertBatch(erpMonthProductivePlanCheckDetails);
return BeanUtils.toBean(erpMonthProductivePlanCheckDetails, ErpMonthProductivePlanCheckDetailRespVO.class);
}
@Override
public void updateErpMonthProductivePlanCheckDetail(ErpMonthProductivePlanCheckDetailSaveReqVO updateReqVO) {
// 校验存在
validateErpMonthProductivePlanCheckDetailExists(updateReqVO.getId());
// 更新
ErpMonthProductivePlanCheckDetailDO updateObj = BeanUtils.toBean(updateReqVO, ErpMonthProductivePlanCheckDetailDO.class);
erpMonthProductivePlanCheckDetailMapper.updateById(updateObj);
}
@Override
public void deleteErpMonthProductivePlanCheckDetail(Long id) {
// 校验存在
validateErpMonthProductivePlanCheckDetailExists(id);
// 删除
erpMonthProductivePlanCheckDetailMapper.deleteById(id);
}
@Override
public void deleteErpMonthProductivePlanCheckDetailListByIds(List<Long> ids) {
// 校验存在
validateErpMonthProductivePlanCheckDetailExists(ids);
// 删除
erpMonthProductivePlanCheckDetailMapper.deleteByIds(ids);
}
private void validateErpMonthProductivePlanCheckDetailExists(List<Long> ids) {
List<ErpMonthProductivePlanCheckDetailDO> list = erpMonthProductivePlanCheckDetailMapper.selectByIds(ids);
if (CollUtil.isEmpty(list) || list.size() != ids.size()) {
throw exception(ERP_MONTH_PRODUCTIVE_PLAN_CHECK_DETAIL_NOT_EXISTS);
}
}
private void validateErpMonthProductivePlanCheckDetailExists(Long id) {
if (erpMonthProductivePlanCheckDetailMapper.selectById(id) == null) {
throw exception(ERP_MONTH_PRODUCTIVE_PLAN_CHECK_DETAIL_NOT_EXISTS);
}
}
@Override
public ErpMonthProductivePlanCheckDetailDO getErpMonthProductivePlanCheckDetail(Long id) {
return erpMonthProductivePlanCheckDetailMapper.selectById(id);
}
@Override
public PageResult<ErpMonthProductivePlanCheckDetailDO> getErpMonthProductivePlanCheckDetailPage(ErpMonthProductivePlanCheckDetailPageReqVO pageReqVO) {
return erpMonthProductivePlanCheckDetailMapper.selectPage(pageReqVO);
}
@Override
public List<ErpMonthProductivePlanCheckDetailRespVO> getErpMonthProductivePlanCheckDetailListByMainId(Long mainId) {
return BeanUtils.toBean(erpMonthProductivePlanCheckDetailMapper.selectList(ErpMonthProductivePlanCheckDetailDO::getMainId, mainId), ErpMonthProductivePlanCheckDetailRespVO.class);
}
}

View File

@@ -0,0 +1,78 @@
package com.zt.plat.module.base.service.erpmonthproductiveplancheck;
import java.util.*;
import com.zt.plat.module.base.controller.admin.erpmonthproductiveplancheck.vo.ErpMonthProductivePlanCheckDetailRespVO;
import com.zt.plat.module.base.controller.admin.erpmonthproductiveplancheck.vo.ErpMonthProductivePlanCheckPageReqVO;
import com.zt.plat.module.base.controller.admin.erpmonthproductiveplancheck.vo.ErpMonthProductivePlanCheckRespVO;
import com.zt.plat.module.base.controller.admin.erpmonthproductiveplancheck.vo.ErpMonthProductivePlanCheckSaveReqVO;
import com.zt.plat.module.base.dal.dataobject.erpmonthproductiveplancheck.ErpMonthProductivePlanCheckDO;
import jakarta.validation.*;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.common.pojo.PageParam;
/**
* ERP月度产品计划核对 Service 接口
*
* @author 后台管理-1
*/
public interface ErpMonthProductivePlanCheckService {
/**
* 创建ERP月度产品计划核对
*
* @param createReqVO 创建信息
* @return 编号
*/
ErpMonthProductivePlanCheckRespVO createErpMonthProductivePlanCheck(@Valid ErpMonthProductivePlanCheckSaveReqVO createReqVO);
/**
* 更新ERP月度产品计划核对
*
* @param updateReqVO 更新信息
*/
void updateErpMonthProductivePlanCheck(@Valid ErpMonthProductivePlanCheckSaveReqVO updateReqVO);
/**
* 删除ERP月度产品计划核对
*
* @param id 编号
*/
void deleteErpMonthProductivePlanCheck(Long id);
/**
* 批量删除ERP月度产品计划核对
*
* @param ids 编号
*/
void deleteErpMonthProductivePlanCheckListByIds(List<Long> ids);
/**
* 获得ERP月度产品计划核对
*
* @param id 编号
* @return ERP月度产品计划核对
*/
ErpMonthProductivePlanCheckDO getErpMonthProductivePlanCheck(Long id);
/**
* 获得ERP月度产品计划核对分页
*
* @param pageReqVO 分页查询
* @return ERP月度产品计划核对分页
*/
PageResult<ErpMonthProductivePlanCheckDO> getErpMonthProductivePlanCheckPage(ErpMonthProductivePlanCheckPageReqVO pageReqVO);
/**
* 批量创建ERP月度产品计划核对
*
* @param createReqVOList 创建信息
*/
void createBatchErpMonthProductivePlanCheck(List<ErpMonthProductivePlanCheckSaveReqVO> createReqVOList);
/**
* 获得ERP月度产品计划核对明细
*
* @param id 编号
* @return ERP月度产品计划核对明细
*/
List<ErpMonthProductivePlanCheckDetailRespVO> getErpMonthProductivePlanCheckDetail(Long id);
}

View File

@@ -0,0 +1,133 @@
package com.zt.plat.module.base.service.erpmonthproductiveplancheck;
import cn.hutool.core.collection.CollUtil;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.common.util.object.BeanUtils;
import com.zt.plat.module.base.controller.admin.erpmonthproductiveplancheck.vo.ErpMonthProductivePlanCheckDetailRespVO;
import com.zt.plat.module.base.controller.admin.erpmonthproductiveplancheck.vo.ErpMonthProductivePlanCheckPageReqVO;
import com.zt.plat.module.base.controller.admin.erpmonthproductiveplancheck.vo.ErpMonthProductivePlanCheckRespVO;
import com.zt.plat.module.base.controller.admin.erpmonthproductiveplancheck.vo.ErpMonthProductivePlanCheckSaveReqVO;
import com.zt.plat.module.base.dal.dao.erpmonthproductiveplancheck.ErpMonthProductivePlanCheckMapper;
import com.zt.plat.module.base.dal.dataobject.erpmonthproductiveplancheck.ErpMonthProductivePlanCheckDO;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import java.util.ArrayList;
import java.util.List;
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.zt.plat.module.erpmonthproductiveplancheck.ErrorCodeConstants.DATA_NOT_ERROR;
import static com.zt.plat.module.erpmonthproductiveplancheck.ErrorCodeConstants.ERP_MONTH_PRODUCTIVE_PLAN_CHECK_NOT_EXISTS;
/**
* ERP月度产品计划核对 Service 实现类
*
* @author 后台管理-1
*/
@Service
@Validated
public class ErpMonthProductivePlanCheckServiceImpl implements ErpMonthProductivePlanCheckService {
@Resource
private ErpMonthProductivePlanCheckMapper erpMonthProductivePlanCheckMapper;
@Resource
private ErpMonthProductivePlanCheckDetailService erpMonthProductivePlanCheckDetailService;
@Override
public ErpMonthProductivePlanCheckRespVO createErpMonthProductivePlanCheck(ErpMonthProductivePlanCheckSaveReqVO createReqVO) {
// 插入
ErpMonthProductivePlanCheckDO erpMonthProductivePlanCheck = BeanUtils.toBean(createReqVO, ErpMonthProductivePlanCheckDO.class);
erpMonthProductivePlanCheckMapper.insert(erpMonthProductivePlanCheck);
List<ErpMonthProductivePlanCheckDetailRespVO> erpMonthProductivePlanCheckDetail = new ArrayList<>();
if (createReqVO.getDetails() != null && !createReqVO.getDetails().isEmpty()) {
createReqVO.getDetails().forEach(detail -> detail.setMainId(erpMonthProductivePlanCheck.getId()));
erpMonthProductivePlanCheckDetail = erpMonthProductivePlanCheckDetailService.createErpMonthProductivePlanCheckDetail(createReqVO.getDetails());
}
// 返回
ErpMonthProductivePlanCheckRespVO erpMonthProductivePlanCheckRespVO = BeanUtils.toBean(erpMonthProductivePlanCheck, ErpMonthProductivePlanCheckRespVO.class);
erpMonthProductivePlanCheckRespVO.setDetails(erpMonthProductivePlanCheckDetail);
return erpMonthProductivePlanCheckRespVO;
}
@Override
public void updateErpMonthProductivePlanCheck(ErpMonthProductivePlanCheckSaveReqVO updateReqVO) {
// 校验存在
validateErpMonthProductivePlanCheckExists(updateReqVO.getId());
// 更新
ErpMonthProductivePlanCheckDO updateObj = BeanUtils.toBean(updateReqVO, ErpMonthProductivePlanCheckDO.class);
erpMonthProductivePlanCheckMapper.updateById(updateObj);
}
@Override
public void deleteErpMonthProductivePlanCheck(Long id) {
// 校验存在
validateErpMonthProductivePlanCheckExists(id);
// 删除
erpMonthProductivePlanCheckMapper.deleteById(id);
}
@Override
public void deleteErpMonthProductivePlanCheckListByIds(List<Long> ids) {
// 校验存在
validateErpMonthProductivePlanCheckExists(ids);
// 删除
erpMonthProductivePlanCheckMapper.deleteByIds(ids);
}
private void validateErpMonthProductivePlanCheckExists(List<Long> ids) {
List<ErpMonthProductivePlanCheckDO> list = erpMonthProductivePlanCheckMapper.selectByIds(ids);
if (CollUtil.isEmpty(list) || list.size() != ids.size()) {
throw exception(ERP_MONTH_PRODUCTIVE_PLAN_CHECK_NOT_EXISTS);
}
}
private void validateErpMonthProductivePlanCheckExists(Long id) {
if (erpMonthProductivePlanCheckMapper.selectById(id) == null) {
throw exception(ERP_MONTH_PRODUCTIVE_PLAN_CHECK_NOT_EXISTS);
}
}
@Override
public ErpMonthProductivePlanCheckDO getErpMonthProductivePlanCheck(Long id) {
return erpMonthProductivePlanCheckMapper.selectById(id);
}
@Override
public PageResult<ErpMonthProductivePlanCheckDO> getErpMonthProductivePlanCheckPage(ErpMonthProductivePlanCheckPageReqVO pageReqVO) {
return erpMonthProductivePlanCheckMapper.selectPage(pageReqVO);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void createBatchErpMonthProductivePlanCheck(List<ErpMonthProductivePlanCheckSaveReqVO> createReqVOList) {
if (createReqVOList == null || createReqVOList.isEmpty()) {
throw exception(DATA_NOT_ERROR);
}
createReqVOList.forEach(createReqVO -> {
ErpMonthProductivePlanCheckDO erpMonthProductivePlanCheck = BeanUtils.toBean(createReqVO, ErpMonthProductivePlanCheckDO.class);
erpMonthProductivePlanCheckMapper.insert(erpMonthProductivePlanCheck);
if (createReqVO.getDetails() != null && !createReqVO.getDetails().isEmpty()) {
createReqVO.getDetails().forEach(detail -> detail.setMainId(erpMonthProductivePlanCheck.getId()));
erpMonthProductivePlanCheckDetailService.createErpMonthProductivePlanCheckDetail(createReqVO.getDetails());
}
});
}
@Override
public List<ErpMonthProductivePlanCheckDetailRespVO> getErpMonthProductivePlanCheckDetail(Long id) {
return setErpMonthProductivePlanCheckDetailData(id);
}
private List<ErpMonthProductivePlanCheckDetailRespVO> setErpMonthProductivePlanCheckDetailData(Long id){
if (id == null){
return new ArrayList<>();
}
return erpMonthProductivePlanCheckDetailService.getErpMonthProductivePlanCheckDetailListByMainId(id);
}
}

View File

@@ -0,0 +1,20 @@
package com.zt.plat.module.base.service.plandate;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.module.base.controller.admin.plandate.vo.PlanDateRespVO;
import com.zt.plat.module.base.controller.admin.plandate.vo.PlanOrderRspVO;
import com.zt.plat.module.base.controller.admin.plandate.vo.PlanOrderSaveReqVO;
import com.zt.plat.module.contractorder.api.dto.order.OrderAndPlanDataReqDTO;
import com.zt.plat.module.contractorder.api.dto.order.OrderDTO;
public interface PlanOrderService {
PlanOrderRspVO bindOrder(PlanOrderSaveReqVO reqVO);
void unbindOrder(String planId, String orderNumber);
PageResult<OrderDTO> getBoundOrder(String id);
PageResult<OrderDTO> queryOrderAndPlanData(OrderAndPlanDataReqDTO reqVO);
}

View File

@@ -0,0 +1,74 @@
package com.zt.plat.module.base.service.plandate;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.common.util.object.BeanUtils;
import com.zt.plat.module.base.controller.admin.plandate.vo.PlanDateRespVO;
import com.zt.plat.module.base.controller.admin.plandate.vo.PlanOrderRspVO;
import com.zt.plat.module.base.controller.admin.plandate.vo.PlanOrderSaveReqVO;
import com.zt.plat.module.base.dal.dao.plandate.PlanOrderMapper;
import com.zt.plat.module.base.dal.dataobject.plandate.PlanOrderDO;
import com.zt.plat.module.contractorder.api.OrderApi;
import com.zt.plat.module.contractorder.api.dto.order.OrderAndPlanDataReqDTO;
import com.zt.plat.module.contractorder.api.dto.order.OrderDTO;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.zt.plat.module.base.enums.ErrorCodeConstants.*;
@Service
@Validated
public class PlanOrderServiceImpl implements PlanOrderService {
@Resource
private PlanOrderMapper planOrderMapper;
@Resource
private OrderApi orderApi;
@Override
public PlanOrderRspVO bindOrder(PlanOrderSaveReqVO reqVO) {
PlanOrderDO bean = BeanUtils.toBean(reqVO, PlanOrderDO.class);
//校验当前计划下是否已存在该类型的订单
validateExists(reqVO);
planOrderMapper.insert(bean);
return BeanUtils.toBean(bean, PlanOrderRspVO.class);
}
@Override
public void unbindOrder(String planId, String orderNumber) {
//检验存在
validateExists(planId, orderNumber);
planOrderMapper.delete(new LambdaQueryWrapper<PlanOrderDO>().eq(PlanOrderDO::getPlanId, planId).eq(PlanOrderDO::getOrderNumber, orderNumber));
}
@Override
public PageResult<OrderDTO> getBoundOrder(String id) {
OrderAndPlanDataReqDTO reqVO = new OrderAndPlanDataReqDTO();
reqVO.setPlanId(id);
CommonResult<PageResult<OrderDTO>> pageResultCommonResult = orderApi.queryOrderPlanData(reqVO);
return pageResultCommonResult.getData();
}
@Override
public PageResult<OrderDTO> queryOrderAndPlanData(OrderAndPlanDataReqDTO reqVO) {
CommonResult<PageResult<OrderDTO>> pageResultCommonResult = orderApi.queryOrderPlanData(reqVO);
return pageResultCommonResult.getData();
}
private void validateExists(PlanOrderSaveReqVO reqVO) {
if (planOrderMapper.exists(new LambdaQueryWrapper<PlanOrderDO>().eq(PlanOrderDO::getPlanId, reqVO.getPlanId()).eq(PlanOrderDO::getOrderType, reqVO.getOrderType()).eq(PlanOrderDO::getOrderNumber, reqVO.getOrderNumber()))) {
throw exception(PLAN_ORD_EXISTS);
}
}
private void validateExists(String planId, String orderNumber) {
if (planOrderMapper.selectOne(new LambdaQueryWrapper<PlanOrderDO>().eq(PlanOrderDO::getPlanId, planId).eq(PlanOrderDO::getOrderNumber, orderNumber),false) == null) {
throw exception(PLAN_ORD_NOT_EXISTS);
}
}
}

View File

@@ -0,0 +1,12 @@
<?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.zt.plat.module.baes.dal.dao.erpmonthproductiveplancheckdetail.ErpMonthProductivePlanCheckDetailMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

View File

@@ -0,0 +1,12 @@
<?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.zt.plat.module.bes.dal.dao.erpmonthproductiveplancheck.ErpMonthProductivePlanCheckMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>