diff --git a/zt-module-contract-order/zt-module-contract-order-api/src/main/java/com/zt/plat/module/contractorder/api/ContractApi.java b/zt-module-contract-order/zt-module-contract-order-api/src/main/java/com/zt/plat/module/contractorder/api/ContractApi.java index 55b7e767..4a764ffb 100644 --- a/zt-module-contract-order/zt-module-contract-order-api/src/main/java/com/zt/plat/module/contractorder/api/ContractApi.java +++ b/zt-module-contract-order/zt-module-contract-order-api/src/main/java/com/zt/plat/module/contractorder/api/ContractApi.java @@ -31,6 +31,11 @@ public interface ContractApi { @Operation(summary = "通过合同编号获取对应的合同信息") ContractRespDTO getContractByPaperNumber(@RequestParam("contractPaperNumber") String contractPaperNumber); + + @GetMapping(PREFIX + "/get/by-sys-number") + @Operation(summary = "通过合同编号获取对应的合同信息") + ContractRespDTO getFormulasBySysNumber(@RequestParam("contractSysNumber") String contractSysNumber); + @GetMapping(PREFIX + "/updateOrderStatus") @Operation(summary = "更新订单状态") CommonResult updateOrderStatus(@RequestParam("orderId") Long orderId, @RequestParam("status") String status); diff --git a/zt-module-contract-order/zt-module-contract-order-api/src/main/java/com/zt/plat/module/contractorder/api/dto/contract/ContractReceiveSendRespDTO.java b/zt-module-contract-order/zt-module-contract-order-api/src/main/java/com/zt/plat/module/contractorder/api/dto/contract/ContractReceiveSendRespDTO.java new file mode 100644 index 00000000..8605c798 --- /dev/null +++ b/zt-module-contract-order/zt-module-contract-order-api/src/main/java/com/zt/plat/module/contractorder/api/dto/contract/ContractReceiveSendRespDTO.java @@ -0,0 +1,63 @@ +package com.zt.plat.module.contractorder.api.dto.contract; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 收发货规则 Response VO") +@Data +public class ContractReceiveSendRespDTO { + @Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "26349") + @ExcelProperty("主键ID") + private Long id; + + @Schema(description = "物料名称", example = "ZT") + @ExcelProperty("物料名称") + private String materialName; + + @Schema(description = "物料编码") + @ExcelProperty("物料编码") + private String materialNumber; + + @Schema(description = "元素缩写") + @ExcelProperty("元素缩写") + private String elementAbbreviation; + + @Schema(description = "元素名称", example = "张三") + @ExcelProperty("元素名称") + private String elementName; + + @Schema(description = "元素编码") + @ExcelProperty("元素编码") + private String elementNumber; + + @Schema(description = "类型", example = "2") + @ExcelProperty("类型") + private String type; + + @Schema(description = "规则") + @ExcelProperty("规则") + private String rule; + + @Schema(description = "区间方式") + @ExcelProperty("区间方式") + private String rangeWay; + + @Schema(description = "区间下限") + @ExcelProperty("区间下限") + private String gradeDown; + + @Schema(description = "区间上限") + @ExcelProperty("区间上限") + private String gradeUp; + + @Schema(description = "合同id", example = "22162") + @ExcelProperty("合同id") + private Long contractId; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; +} diff --git a/zt-module-contract-order/zt-module-contract-order-api/src/main/java/com/zt/plat/module/contractorder/api/dto/contract/ContractRespDTO.java b/zt-module-contract-order/zt-module-contract-order-api/src/main/java/com/zt/plat/module/contractorder/api/dto/contract/ContractRespDTO.java index 42f265fe..48d6c169 100644 --- a/zt-module-contract-order/zt-module-contract-order-api/src/main/java/com/zt/plat/module/contractorder/api/dto/contract/ContractRespDTO.java +++ b/zt-module-contract-order/zt-module-contract-order-api/src/main/java/com/zt/plat/module/contractorder/api/dto/contract/ContractRespDTO.java @@ -283,4 +283,6 @@ public class ContractRespDTO { // 品位不计价规则 private List nots; + //收发货规则 + private List contractReceiveSends; } diff --git a/zt-module-contract-order/zt-module-contract-order-api/src/main/java/com/zt/plat/module/contractorder/api/vo/contract/ContractReceiveSendPageReqVO.java b/zt-module-contract-order/zt-module-contract-order-api/src/main/java/com/zt/plat/module/contractorder/api/vo/contract/ContractReceiveSendPageReqVO.java new file mode 100644 index 00000000..34326db6 --- /dev/null +++ b/zt-module-contract-order/zt-module-contract-order-api/src/main/java/com/zt/plat/module/contractorder/api/vo/contract/ContractReceiveSendPageReqVO.java @@ -0,0 +1,53 @@ +package com.zt.plat.module.contractorder.api.vo.contract; + +import com.zt.plat.framework.common.pojo.PageParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +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 = "管理后台 - 收发货规则分页 Request VO") +@Data +public class ContractReceiveSendPageReqVO extends PageParam { + + @Schema(description = "物料名称", example = "ZT") + private String materialName; + + @Schema(description = "物料编码") + private String materialNumber; + + @Schema(description = "元素缩写") + private String elementAbbreviation; + + @Schema(description = "元素名称", example = "张三") + private String elementName; + + @Schema(description = "元素编码") + private String elementNumber; + + @Schema(description = "类型", example = "2") + private String type; + + @Schema(description = "规则") + private String rule; + + @Schema(description = "区间方式") + private String rangeWay; + + @Schema(description = "区间下限") + private String gradeDown; + + @Schema(description = "区间上限") + private String gradeUp; + + @Schema(description = "合同id", example = "22162") + private Long contractId; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} \ No newline at end of file diff --git a/zt-module-contract-order/zt-module-contract-order-api/src/main/java/com/zt/plat/module/contractorder/api/vo/contract/ContractReceiveSendRespVO.java b/zt-module-contract-order/zt-module-contract-order-api/src/main/java/com/zt/plat/module/contractorder/api/vo/contract/ContractReceiveSendRespVO.java new file mode 100644 index 00000000..f9eb9247 --- /dev/null +++ b/zt-module-contract-order/zt-module-contract-order-api/src/main/java/com/zt/plat/module/contractorder/api/vo/contract/ContractReceiveSendRespVO.java @@ -0,0 +1,67 @@ +package com.zt.plat.module.contractorder.api.vo.contract; + +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 收发货规则 Response VO") +@Data +@ExcelIgnoreUnannotated +public class ContractReceiveSendRespVO { + + @Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "26349") + @ExcelProperty("主键ID") + private Long id; + + @Schema(description = "物料名称", example = "ZT") + @ExcelProperty("物料名称") + private String materialName; + + @Schema(description = "物料编码") + @ExcelProperty("物料编码") + private String materialNumber; + + @Schema(description = "元素缩写") + @ExcelProperty("元素缩写") + private String elementAbbreviation; + + @Schema(description = "元素名称", example = "张三") + @ExcelProperty("元素名称") + private String elementName; + + @Schema(description = "元素编码") + @ExcelProperty("元素编码") + private String elementNumber; + + @Schema(description = "类型", example = "2") + @ExcelProperty("类型") + private String type; + + @Schema(description = "规则") + @ExcelProperty("规则") + private String rule; + + @Schema(description = "区间方式") + @ExcelProperty("区间方式") + private String rangeWay; + + @Schema(description = "区间下限") + @ExcelProperty("区间下限") + private String gradeDown; + + @Schema(description = "区间上限") + @ExcelProperty("区间上限") + private String gradeUp; + + @Schema(description = "合同id", example = "22162") + @ExcelProperty("合同id") + private Long contractId; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} \ No newline at end of file diff --git a/zt-module-contract-order/zt-module-contract-order-api/src/main/java/com/zt/plat/module/contractorder/api/vo/contract/ContractReceiveSendSaveReqVO.java b/zt-module-contract-order/zt-module-contract-order-api/src/main/java/com/zt/plat/module/contractorder/api/vo/contract/ContractReceiveSendSaveReqVO.java new file mode 100644 index 00000000..86f6a460 --- /dev/null +++ b/zt-module-contract-order/zt-module-contract-order-api/src/main/java/com/zt/plat/module/contractorder/api/vo/contract/ContractReceiveSendSaveReqVO.java @@ -0,0 +1,46 @@ +package com.zt.plat.module.contractorder.api.vo.contract; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Schema(description = "管理后台 - 收发货规则新增/修改 Request VO") +@Data +public class ContractReceiveSendSaveReqVO { + + @Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "26349") + private Long id; + + @Schema(description = "物料名称", example = "ZT") + private String materialName; + + @Schema(description = "物料编码") + private String materialNumber; + + @Schema(description = "元素缩写") + private String elementAbbreviation; + + @Schema(description = "元素名称", example = "张三") + private String elementName; + + @Schema(description = "元素编码") + private String elementNumber; + + @Schema(description = "类型", example = "2") + private String type; + + @Schema(description = "规则") + private String rule; + + @Schema(description = "区间方式") + private String rangeWay; + + @Schema(description = "区间下限") + private String gradeDown; + + @Schema(description = "区间上限") + private String gradeUp; + + @Schema(description = "合同id", example = "22162") + private Long contractId; + +} \ No newline at end of file diff --git a/zt-module-contract-order/zt-module-contract-order-api/src/main/java/com/zt/plat/module/contractorder/api/vo/contract/ContractRespVO.java b/zt-module-contract-order/zt-module-contract-order-api/src/main/java/com/zt/plat/module/contractorder/api/vo/contract/ContractRespVO.java index b695085a..982d4d72 100644 --- a/zt-module-contract-order/zt-module-contract-order-api/src/main/java/com/zt/plat/module/contractorder/api/vo/contract/ContractRespVO.java +++ b/zt-module-contract-order/zt-module-contract-order-api/src/main/java/com/zt/plat/module/contractorder/api/vo/contract/ContractRespVO.java @@ -272,6 +272,9 @@ public class ContractRespVO { @Schema(description = "乙方税号/社会信用代码") private String salesTaxNumber; + @Schema(description = "是否信用", example = "1") + private String hasCredit; + // 物料信息 private List detail; diff --git a/zt-module-contract-order/zt-module-contract-order-api/src/main/java/com/zt/plat/module/contractorder/api/vo/contract/ContractSaveReqVO.java b/zt-module-contract-order/zt-module-contract-order-api/src/main/java/com/zt/plat/module/contractorder/api/vo/contract/ContractSaveReqVO.java index e5171296..535cadd8 100644 --- a/zt-module-contract-order/zt-module-contract-order-api/src/main/java/com/zt/plat/module/contractorder/api/vo/contract/ContractSaveReqVO.java +++ b/zt-module-contract-order/zt-module-contract-order-api/src/main/java/com/zt/plat/module/contractorder/api/vo/contract/ContractSaveReqVO.java @@ -9,6 +9,7 @@ import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.Size; import lombok.Data; + import java.math.BigDecimal; import java.util.List; @@ -241,6 +242,10 @@ public class ContractSaveReqVO { @Schema(description = "乙方税号/社会信用代码") private String salesTaxNumber; + @Schema(description = "是否信用", example = "1") + private String hasCredit; + // 收发货规则 + private List contractReceiveSends; // 物料信息 private List detail; diff --git a/zt-module-contract-order/zt-module-contract-order-api/src/main/java/com/zt/plat/module/contractorder/enums/ErrorCodeConstants.java b/zt-module-contract-order/zt-module-contract-order-api/src/main/java/com/zt/plat/module/contractorder/enums/ErrorCodeConstants.java index 0e837b7d..efa7b425 100644 --- a/zt-module-contract-order/zt-module-contract-order-api/src/main/java/com/zt/plat/module/contractorder/enums/ErrorCodeConstants.java +++ b/zt-module-contract-order/zt-module-contract-order-api/src/main/java/com/zt/plat/module/contractorder/enums/ErrorCodeConstants.java @@ -32,4 +32,7 @@ public interface ErrorCodeConstants { ErrorCode CONTRACT_PARTNER_NOT_EXISTS = new ErrorCode(1_027_000_017, "客商信息不存在"); ErrorCode CONTRACT_PUSH_FAIL = new ErrorCode(1_027_000_019, "推送合同失败:{}"); ErrorCode CONTRACT_STATUS_NOT_CANCEL = new ErrorCode(1_027_000_020, "{}状态合同不允许作废"); + + ErrorCode CONTRACT_RECEIVE_SEND_NOT_EXISTS = new ErrorCode(1_027_000_021, "收发货规则不存在"); + } diff --git a/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/api/ContractApiImpl.java b/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/api/ContractApiImpl.java index ba432a4a..feca0031 100644 --- a/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/api/ContractApiImpl.java +++ b/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/api/ContractApiImpl.java @@ -80,6 +80,11 @@ public class ContractApiImpl implements ContractApi { return contractService.getFormulasByPaperNumber(contractPaperNumber); } + @Override + public ContractRespDTO getFormulasBySysNumber(String contractSysNumber) { + return contractService.getFormulasByPaperNumber(contractSysNumber); + } + @Override public CommonResult updateOrderStatus(Long orderId, String status) { return success(purchaseOrderService.updateOrderStatus(orderId, status)); diff --git a/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/controller/admin/contractreceivesend/ContractReceiveSendController.java b/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/controller/admin/contractreceivesend/ContractReceiveSendController.java new file mode 100644 index 00000000..dbc8b553 --- /dev/null +++ b/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/controller/admin/contractreceivesend/ContractReceiveSendController.java @@ -0,0 +1,105 @@ +package com.zt.plat.module.contractorder.controller.admin.contractreceivesend; + +import com.zt.plat.framework.apilog.core.annotation.ApiAccessLog; +import com.zt.plat.framework.business.interceptor.BusinessControllerMarker; +import com.zt.plat.framework.common.pojo.CommonResult; +import com.zt.plat.framework.common.pojo.PageParam; +import com.zt.plat.framework.common.pojo.PageResult; +import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO; +import com.zt.plat.framework.common.util.object.BeanUtils; +import com.zt.plat.framework.excel.core.util.ExcelUtils; +import com.zt.plat.module.contractorder.api.vo.contract.ContractReceiveSendPageReqVO; +import com.zt.plat.module.contractorder.api.vo.contract.ContractReceiveSendRespVO; +import com.zt.plat.module.contractorder.api.vo.contract.ContractReceiveSendSaveReqVO; +import com.zt.plat.module.contractorder.dal.dataobject.contractreceivesend.ContractReceiveSendDO; +import com.zt.plat.module.contractorder.service.contractreceivesend.ContractReceiveSendService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.Valid; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.io.IOException; +import java.util.List; + +import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.EXPORT; +import static com.zt.plat.framework.common.pojo.CommonResult.success; + +@Tag(name = "管理后台 - 收发货规则") +@RestController +@RequestMapping("/base/contract-receive-send") +@Validated +public class ContractReceiveSendController implements BusinessControllerMarker { + + + @Resource + private ContractReceiveSendService contractReceiveSendService; + + @PostMapping("/create") + @Operation(summary = "创建收发货规则") + @PreAuthorize("@ss.hasPermission('bse:contract-receive-send:create')") + public CommonResult createContractReceiveSend(@Valid @RequestBody ContractReceiveSendSaveReqVO createReqVO) { + return success(contractReceiveSendService.createContractReceiveSend(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新收发货规则") + @PreAuthorize("@ss.hasPermission('bse:contract-receive-send:update')") + public CommonResult updateContractReceiveSend(@Valid @RequestBody ContractReceiveSendSaveReqVO updateReqVO) { + contractReceiveSendService.updateContractReceiveSend(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除收发货规则") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('bse:contract-receive-send:delete')") + public CommonResult deleteContractReceiveSend(@RequestParam("id") Long id) { + contractReceiveSendService.deleteContractReceiveSend(id); + return success(true); + } + + @DeleteMapping("/delete-list") + @Parameter(name = "ids", description = "编号", required = true) + @Operation(summary = "批量删除收发货规则") + @PreAuthorize("@ss.hasPermission('bse:contract-receive-send:delete')") + public CommonResult deleteContractReceiveSendList(@RequestBody BatchDeleteReqVO req) { + contractReceiveSendService.deleteContractReceiveSendListByIds(req.getIds()); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得收发货规则") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('bse:contract-receive-send:query')") + public CommonResult getContractReceiveSend(@RequestParam("id") Long id) { + ContractReceiveSendDO contractReceiveSend = contractReceiveSendService.getContractReceiveSend(id); + return success(BeanUtils.toBean(contractReceiveSend, ContractReceiveSendRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得收发货规则分页") + @PreAuthorize("@ss.hasPermission('bse:contract-receive-send:query')") + public CommonResult> getContractReceiveSendPage(@Valid ContractReceiveSendPageReqVO pageReqVO) { + PageResult pageResult = contractReceiveSendService.getContractReceiveSendPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, ContractReceiveSendRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出收发货规则 Excel") + @PreAuthorize("@ss.hasPermission('bse:contract-receive-send:export')") + @ApiAccessLog(operateType = EXPORT) + public void exportContractReceiveSendExcel(@Valid ContractReceiveSendPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = contractReceiveSendService.getContractReceiveSendPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "收发货规则.xls", "数据", ContractReceiveSendRespVO.class, + BeanUtils.toBean(list, ContractReceiveSendRespVO.class)); + } + +} \ No newline at end of file diff --git a/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/dal/dataobject/contract/ContractMainDO.java b/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/dal/dataobject/contract/ContractMainDO.java index 5b0a4c50..2ca8402f 100644 --- a/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/dal/dataobject/contract/ContractMainDO.java +++ b/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/dal/dataobject/contract/ContractMainDO.java @@ -450,4 +450,9 @@ public class ContractMainDO extends BusinessBaseDO { */ @TableField("SALE_TAX_NUM") private String salesTaxNumber; + /** + * 否启用授信 + */ + @TableField("HS_CRDT") + private String hasCredit; } \ No newline at end of file diff --git a/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/dal/dataobject/contractreceivesend/ContractReceiveSendDO.java b/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/dal/dataobject/contractreceivesend/ContractReceiveSendDO.java new file mode 100644 index 00000000..2880b856 --- /dev/null +++ b/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/dal/dataobject/contractreceivesend/ContractReceiveSendDO.java @@ -0,0 +1,88 @@ +package com.zt.plat.module.contractorder.dal.dataobject.contractreceivesend; + +import com.baomidou.mybatisplus.annotation.*; +import com.zt.plat.framework.mybatis.core.dataobject.BusinessBaseDO; +import lombok.*; + +/** +* 收发货规则 DO +* +* @author 后台管理-1 +*/ +@TableName("bse_ctrt_rcv_snd") +@KeySequence("bse_ctrt_rcv_snd_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +/** +* 支持业务基类继承:isBusiness=true 时继承 BusinessBaseDO,否则继承 BaseDO +*/ +public class ContractReceiveSendDO extends BusinessBaseDO { + + + + /** + * 主键ID + */ + @TableId(type = IdType.ASSIGN_ID) + private Long id; + /** + * 物料名称 + */ + @TableField("MTRL_NAME") + private String materialName; + /** + * 物料编码 + */ + @TableField("MTRL_NUM") + private String materialNumber; + /** + * 元素缩写 + */ + @TableField("ELEM_ABBR") + private String elementAbbreviation; + /** + * 元素名称 + */ + @TableField("ELEM_NAME") + private String elementName; + /** + * 元素编码 + */ + @TableField("ELEM_NUM") + private String elementNumber; + /** + * 类型 + */ + @TableField("TP") + private String type; + /** + * 规则 + */ + @TableField("RUL") + private String rule; + /** + * 区间方式 + */ + @TableField("RNG_WY") + private String rangeWay; + /** + * 区间下限 + */ + @TableField("GRD_DOWN") + private String gradeDown; + /** + * 区间上限 + */ + @TableField("GRD_UP") + private String gradeUp; + /** + * 合同id + */ + @TableField("CTRT_ID") + private Long contractId; + +} \ No newline at end of file diff --git a/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/dal/mysql/contractreceivesend/ContractReceiveSendMapper.java b/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/dal/mysql/contractreceivesend/ContractReceiveSendMapper.java new file mode 100644 index 00000000..8eb2d633 --- /dev/null +++ b/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/dal/mysql/contractreceivesend/ContractReceiveSendMapper.java @@ -0,0 +1,36 @@ +package com.zt.plat.module.contractorder.dal.mysql.contractreceivesend; + +import com.zt.plat.framework.common.pojo.PageResult; +import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX; +import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX; + +import com.zt.plat.module.contractorder.api.vo.contract.ContractReceiveSendPageReqVO; +import com.zt.plat.module.contractorder.dal.dataobject.contractreceivesend.ContractReceiveSendDO; +import org.apache.ibatis.annotations.Mapper; + +/** + * 收发货规则 Mapper + * + * @author 后台管理-1 + */ +@Mapper +public interface ContractReceiveSendMapper extends BaseMapperX { + + default PageResult selectPage(ContractReceiveSendPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .likeIfPresent(ContractReceiveSendDO::getMaterialName, reqVO.getMaterialName()) + .eqIfPresent(ContractReceiveSendDO::getMaterialNumber, reqVO.getMaterialNumber()) + .eqIfPresent(ContractReceiveSendDO::getElementAbbreviation, reqVO.getElementAbbreviation()) + .likeIfPresent(ContractReceiveSendDO::getElementName, reqVO.getElementName()) + .eqIfPresent(ContractReceiveSendDO::getElementNumber, reqVO.getElementNumber()) + .eqIfPresent(ContractReceiveSendDO::getType, reqVO.getType()) + .eqIfPresent(ContractReceiveSendDO::getRule, reqVO.getRule()) + .eqIfPresent(ContractReceiveSendDO::getRangeWay, reqVO.getRangeWay()) + .eqIfPresent(ContractReceiveSendDO::getGradeDown, reqVO.getGradeDown()) + .eqIfPresent(ContractReceiveSendDO::getGradeUp, reqVO.getGradeUp()) + .eqIfPresent(ContractReceiveSendDO::getContractId, reqVO.getContractId()) + .betweenIfPresent(ContractReceiveSendDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(ContractReceiveSendDO::getId)); + } + +} \ No newline at end of file diff --git a/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/service/contract/ContractService.java b/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/service/contract/ContractService.java index 6b112c64..7304312f 100644 --- a/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/service/contract/ContractService.java +++ b/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/service/contract/ContractService.java @@ -99,6 +99,14 @@ public interface ContractService { */ ContractRespDTO getFormulasByPaperNumber(String contractPaperNumber); + + /** + * 通过合同编号获取对应的合同信息 + * + * @param contractSysNumber 合同编号 + * @return 结算条款数据 + */ + ContractRespDTO getFormulasBySysNumber(String contractSysNumber); /** * 提交ERP * diff --git a/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/service/contract/ContractServiceImpl.java b/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/service/contract/ContractServiceImpl.java index c326c5f3..e405ab6d 100644 --- a/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/service/contract/ContractServiceImpl.java +++ b/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/service/contract/ContractServiceImpl.java @@ -34,6 +34,7 @@ import com.zt.plat.module.contractorder.enums.DictTypeConstants; import com.zt.plat.module.contractorder.enums.ProcessConstants; import com.zt.plat.module.contractorder.enums.TableFieldConstants; import com.zt.plat.module.contractorder.enums.contract.DictEnum; +import com.zt.plat.module.contractorder.service.contractreceivesend.ContractReceiveSendService; import com.zt.plat.module.erp.controller.admin.erp.vo.ErpContractPageReqVO; import com.zt.plat.module.erp.controller.admin.erp.vo.ErpContractSaveReqVO; import com.zt.plat.module.erp.dal.dataobject.erp.ErpContractDO; @@ -118,6 +119,9 @@ public class ContractServiceImpl implements ContractService { @Resource private TmplInscItmBsnService tmplInscItmBsnService; + @Resource + private ContractReceiveSendService contractReceiveSendService; + @Override public PageResult getContractPage(ContractPageReqVO pageReqVO) { return contractMainMapper.selectContractPage(pageReqVO); @@ -177,7 +181,7 @@ public class ContractServiceImpl implements ContractService { // 合同明细ID Long detailDOId = detailDO.getId(); // 交货计划 - if (detail.getPlans() != null && !detail.getPlans().isEmpty()) { + if (detail.getPlans() != null && !detail.getPlans().isEmpty()) { detail.getPlans().forEach(plan -> { // 交货计划DO ContractPlanDO planDO = BeanUtils.toBean(plan, ContractPlanDO.class); @@ -236,7 +240,7 @@ public class ContractServiceImpl implements ContractService { }); } // 市场价配置 - if (formula.getPrices()!= null && !formula.getPrices().isEmpty()) { + if (formula.getPrices() != null && !formula.getPrices().isEmpty()) { formula.getPrices().forEach(price -> { // 市场价配置DO ContractPriceDO priceDO = BeanUtils.toBean(price, ContractPriceDO.class); @@ -297,7 +301,13 @@ public class ContractServiceImpl implements ContractService { // }); tmplInscItmBsnService.updateTmplInscItmBsnBatch(dynamicsItems); } - +//插入收发货规则 + if (reqVO.getContractReceiveSends() != null && !reqVO.getContractReceiveSends().isEmpty()) { + reqVO.getContractReceiveSends().forEach(contractReceiveSend -> { + contractReceiveSend.setContractId(contractId); + contractReceiveSendService.createContractReceiveSend(contractReceiveSend); + }); + } return contractId; } @@ -400,7 +410,7 @@ public class ContractServiceImpl implements ContractService { ContractRespVO respVO = new ContractRespVO(); // 查询并设置合同主信息 - ContractMainDO contractMainDO = contractMainMapper.selectOne(TableFieldConstants.BSE_CTRT_MAIN_SYS_CTRT_NUM,systemContractNumber); + ContractMainDO contractMainDO = contractMainMapper.selectOne(TableFieldConstants.BSE_CTRT_MAIN_SYS_CTRT_NUM, systemContractNumber); if (contractMainDO == null) { throw exception(CONTRACT_NOT_EXISTS); } @@ -504,7 +514,7 @@ public class ContractServiceImpl implements ContractService { // 已关联的上游合同id集合 List systemRelativityDOS = systemRelativityMapper.selectList(); LinkedHashSet relationIds = new LinkedHashSet<>(); - if (systemRelativityDOS!= null && !systemRelativityDOS.isEmpty()) { + if (systemRelativityDOS != null && !systemRelativityDOS.isEmpty()) { systemRelativityDOS.forEach(systemRelativityDO -> { relationIds.add(systemRelativityDO.getUpId()); }); @@ -528,7 +538,7 @@ public class ContractServiceImpl implements ContractService { // 查询 List contractMainDOS = contractMainMapper.selectList(conditon); result = BeanUtils.toBean(contractMainDOS, ContractRespVO.class); - } else if (DictEnum.ERP_RCV_DLVY_EXPENSES.getCode().equals(direction)){ // 支出 + } else if (DictEnum.ERP_RCV_DLVY_EXPENSES.getCode().equals(direction)) { // 支出 // 如果“收支性质”字段为支出,用“乙方公司编号”字段筛选“合同主信息”表中字段等于“甲方公司编号”的数据 if (StringUtils.isEmpty(salesCompanyNumber)) { // 乙方公司编号不存在 @@ -572,7 +582,7 @@ public class ContractServiceImpl implements ContractService { // 已关联的上游合同id集合 List systemRelativityDOS = systemRelativityMapper.selectList(); LinkedHashSet relationIds = new LinkedHashSet<>(); - if (systemRelativityDOS!= null && !systemRelativityDOS.isEmpty()) { + if (systemRelativityDOS != null && !systemRelativityDOS.isEmpty()) { systemRelativityDOS.forEach(systemRelativityDO -> { relationIds.add(systemRelativityDO.getDownId()); }); @@ -596,7 +606,7 @@ public class ContractServiceImpl implements ContractService { // 查询 List contractMainDOS = contractMainMapper.selectList(conditon); result = BeanUtils.toBean(contractMainDOS, ContractRespVO.class); - } else if (DictEnum.ERP_RCV_DLVY_EXPENSES.getCode().equals(direction)){ // 支出 + } else if (DictEnum.ERP_RCV_DLVY_EXPENSES.getCode().equals(direction)) { // 支出 // 如果“收支性质”字段为支出,用“乙方公司编号”字段筛选“合同主信息”表中字段等于“甲方公司编号”的数据 if (StringUtils.isEmpty(salesCompanyNumber)) { // 乙方公司编号不存在 @@ -790,7 +800,7 @@ public class ContractServiceImpl implements ContractService { // 合同明细ID Long detailDOId = detailDO.getId(); // 交货计划 - if (detail.getPlans() != null && !detail.getPlans().isEmpty()) { + if (detail.getPlans() != null && !detail.getPlans().isEmpty()) { detail.getPlans().forEach(plan -> { // 交货计划DO ContractPlanDO planDO = BeanUtils.toBean(plan, ContractPlanDO.class); @@ -859,7 +869,7 @@ public class ContractServiceImpl implements ContractService { }); } // 市场价配置 - if (formula.getPrices()!= null && !formula.getPrices().isEmpty()) { + if (formula.getPrices() != null && !formula.getPrices().isEmpty()) { formula.getPrices().forEach(price -> { // 市场价配置DO ContractPriceDO priceDO = BeanUtils.toBean(price, ContractPriceDO.class); @@ -1291,7 +1301,7 @@ public class ContractServiceImpl implements ContractService { // 通过合同编号查询合同信息 ContractMainDO contractMainDO = contractMainMapper - .selectOne(TableFieldConstants.BSE_CTRT_MAIN_CTRT_PPR_NUM, contractPaperNumber); + .selectOne(ContractMainDO::getSystemContractNumber, contractPaperNumber); // 合同不存在 if (contractMainDO == null) { @@ -1369,10 +1379,111 @@ public class ContractServiceImpl implements ContractService { if (notDOS != null && !notDOS.isEmpty()) { respDTO.setNots(BeanUtils.toBean(notDOS, NotRespDTO.class)); } + //收发货 + List contractReceiveSendListByContractId = contractReceiveSendService.getContractReceiveSendListByContractId(contractMainDO.getId()); + if (contractReceiveSendListByContractId!=null&&!contractReceiveSendListByContractId.isEmpty()){ + respDTO.setContractReceiveSends(BeanUtils.toBean(contractReceiveSendListByContractId, ContractReceiveSendRespDTO.class)); + } return respDTO; } + + @Override + public ContractRespDTO getFormulasBySysNumber(String contractSysNumber) { + + // 通过合同编号查询合同信息 + ContractMainDO contractMainDO = contractMainMapper + .selectOne(TableFieldConstants.BSE_CTRT_MAIN_CTRT_PPR_NUM, contractSysNumber); + + // 合同不存在 + if (contractMainDO == null) { + throw exception(CONTRACT_NOT_EXISTS); + } + + // 合同ID + Long contractId = contractMainDO.getId(); + + // 返回结果 + ContractRespDTO respDTO = new ContractRespDTO(); + BeanUtils.copyProperties(contractMainDO, respDTO); + + // 查询并设置合同明细 + List detailDOS = contractDetailMapper + .selectList(TableFieldConstants.BSE_CTRT_DTL_CTRT_MAIN_ID, contractMainDO.getId()); + if (detailDOS != null && !detailDOS.isEmpty()) { + respDTO.setDetail(BeanUtils.toBean(detailDOS, DetailRespDTO.class)); + respDTO.getDetail().forEach(detail -> { + + // 查询并设置交货计划 + List planDOS = contractPlanMapper + .selectList(TableFieldConstants.BSE_CTRT_PLN_CTRT_DTL_ID, detail.getId()); + if (planDOS != null && !planDOS.isEmpty()) { + detail.setPlans(BeanUtils.toBean(planDOS, PlanRespDTO.class)); + } + }); + } + + // 查询并设置价款结算条款 + List formulaDOS = contractFormulaMapper + .selectList(TableFieldConstants.BSE_CTRT_FMU_CTRT_ID, contractId); + if (formulaDOS != null && !formulaDOS.isEmpty()) { + respDTO.setFormulas(BeanUtils.toBean(formulaDOS, FormulaRespDTO.class)); + + respDTO.getFormulas().forEach(formula -> { + + // 查询并设置基础系数配置 + List coefficientDOS = contractCoefficientMapper + .selectList(TableFieldConstants.BSE_CTRT_COEF_FMU_ID, formula.getId()); + if (coefficientDOS != null && !coefficientDOS.isEmpty()) { + formula.setCoefficients(BeanUtils.toBean(coefficientDOS, CoefficientRespDTO.class)); + } + // 查询并设置品位等级价配置 + List gradeDOS = contractGradeMapper + .selectList(TableFieldConstants.BSE_CTRT_GRD_FMU_ID, formula.getId()); + if (gradeDOS != null && !gradeDOS.isEmpty()) { + formula.setGrades(BeanUtils.toBean(gradeDOS, GradeRespDTO.class)); + } + // 查询并设置调整价配置 + List deductDOS = contractDeductMapper + .selectList(TableFieldConstants.BSE_CTRT_DDCT_FMU_ID, formula.getId()); + if (deductDOS != null && !deductDOS.isEmpty()) { + formula.setDeducts(BeanUtils.toBean(deductDOS, DeductRespDTO.class)); + } + // 查询并设置市场价配置 + List priceDOS = contractPriceMapper + .selectList(TableFieldConstants.BSE_CTRT_PRC_FMU_ID, formula.getId()); + if (priceDOS != null && !priceDOS.isEmpty()) { + formula.setPrices(BeanUtils.toBean(priceDOS, PriceRespDTO.class)); + } + }); + } + + // 查询并设置参数降级规则 + List demoteDOS = contractDemoteMapper + .selectList(TableFieldConstants.BSE_CTRT_DMOT_CTRT_ID, contractMainDO.getId()); + if (demoteDOS != null && !demoteDOS.isEmpty()) { + respDTO.setDemotes(BeanUtils.toBean(demoteDOS, DemoteRespDTO.class)); + } + + // 查询并设置品位不计价规则 + List notDOS = contractNotMapper + .selectList(TableFieldConstants.BSE_CTRT_NT_CTRT_ID, contractMainDO.getId()); + if (notDOS != null && !notDOS.isEmpty()) { + respDTO.setNots(BeanUtils.toBean(notDOS, NotRespDTO.class)); + } + //收发货 + List contractReceiveSendListByContractId = contractReceiveSendService.getContractReceiveSendListByContractId(contractMainDO.getId()); + if (contractReceiveSendListByContractId!=null&&!contractReceiveSendListByContractId.isEmpty()){ + respDTO.setContractReceiveSends(BeanUtils.toBean(contractReceiveSendListByContractId, ContractReceiveSendRespDTO.class)); + } + + return respDTO; + } + + + + @Override public JSONObject submitErp(Long id) { @@ -1503,7 +1614,7 @@ public class ContractServiceImpl implements ContractService { } // 上传模板附件 - if(StringUtils.isNotBlank(contractMainDO.getFileObject())){ + if (StringUtils.isNotBlank(contractMainDO.getFileObject())) { JSONArray fileObjects = new JSONArray(contractMainDO.getFileObject()); for (int i = 0; i < fileObjects.size(); i++) { JSONObject file = fileObjects.getJSONObject(i); @@ -1517,7 +1628,7 @@ public class ContractServiceImpl implements ContractService { } // 合同其它附件 - if(StringUtils.isNotBlank(contractMainDO.getFileObjectOther())){ + if (StringUtils.isNotBlank(contractMainDO.getFileObjectOther())) { JSONArray fileObjectOthers = new JSONArray(contractMainDO.getFileObjectOther()); for (int i = 0; i < fileObjectOthers.size(); i++) { JSONObject file = fileObjectOthers.getJSONObject(i); @@ -1542,7 +1653,7 @@ public class ContractServiceImpl implements ContractService { zips.finish(); return ResponseEntity.ok() - .header(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=contract-file-"+ System.currentTimeMillis()+".zip") + .header(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=contract-file-" + System.currentTimeMillis() + ".zip") .contentType(MediaType.APPLICATION_OCTET_STREAM) .body(new ByteArrayResource(zipsByte.toByteArray())); } catch (Exception e) { @@ -1665,7 +1776,7 @@ public class ContractServiceImpl implements ContractService { * @param contractMainDO 合同主信息 * @return 操作标识 */ - private String getOperationId(ContractMainDO contractMainDO){ + private String getOperationId(ContractMainDO contractMainDO) { String operationId = null; // 1、先调用009ERP接口查询合同信息 @@ -2066,12 +2177,12 @@ public class ContractServiceImpl implements ContractService { // 单据名称(拼音) String documentName = "XTHT"; // 公司编码 - String companyId = CompanyContextHolder.getCompanyId()!= null ? CompanyContextHolder.getCompanyId().toString() : ""; + String companyId = CompanyContextHolder.getCompanyId() != null ? CompanyContextHolder.getCompanyId().toString() : ""; // 年月日 String yearMounth8Bit = LocalDate.now() .format(DateTimeFormatter.ofPattern(DateConstants.DATE_FORMAT_YEAR_MONTH_DAY_8_BIT)); // 查询最大编号 - String numPrefix = documentName+"-"+category+"-"+companyId+"-"+yearMounth8Bit; + String numPrefix = documentName + "-" + category + "-" + companyId + "-" + yearMounth8Bit; QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.likeRight("SYS_CTRT_NUM", numPrefix); queryWrapper.orderByDesc("SYS_CTRT_NUM"); @@ -2095,7 +2206,7 @@ public class ContractServiceImpl implements ContractService { /** * 获取合同ID集合 * - * @param contractName 合同名称 + * @param contractName 合同名称 * @param contractPaperNumber 合同编号 * @return 合同ID集合 */ diff --git a/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/service/contractreceivesend/ContractReceiveSendService.java b/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/service/contractreceivesend/ContractReceiveSendService.java new file mode 100644 index 00000000..1cdab472 --- /dev/null +++ b/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/service/contractreceivesend/ContractReceiveSendService.java @@ -0,0 +1,73 @@ +package com.zt.plat.module.contractorder.service.contractreceivesend; + +import com.zt.plat.framework.common.pojo.PageResult; + +import com.zt.plat.module.contractorder.api.vo.contract.ContractReceiveSendPageReqVO; +import com.zt.plat.module.contractorder.api.vo.contract.ContractReceiveSendRespVO; +import com.zt.plat.module.contractorder.api.vo.contract.ContractReceiveSendSaveReqVO; +import com.zt.plat.module.contractorder.dal.dataobject.contractreceivesend.ContractReceiveSendDO; +import jakarta.validation.Valid; + +import java.util.List; + +/** + * 收发货规则 Service 接口 + * + * @author 后台管理-1 + */ +public interface ContractReceiveSendService { + + /** + * 创建收发货规则 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + ContractReceiveSendRespVO createContractReceiveSend(@Valid ContractReceiveSendSaveReqVO createReqVO); + + /** + * 更新收发货规则 + * + * @param updateReqVO 更新信息 + */ + void updateContractReceiveSend(@Valid ContractReceiveSendSaveReqVO updateReqVO); + + /** + * 删除收发货规则 + * + * @param id 编号 + */ + void deleteContractReceiveSend(Long id); + + /** + * 批量删除收发货规则 + * + * @param ids 编号 + */ + void deleteContractReceiveSendListByIds(List ids); + + /** + * 获得收发货规则 + * + * @param id 编号 + * @return 收发货规则 + */ + ContractReceiveSendDO getContractReceiveSend(Long id); + + /** + * 获得收发货规则分页 + * + * @param pageReqVO 分页查询 + * @return 收发货规则分页 + */ + PageResult getContractReceiveSendPage(ContractReceiveSendPageReqVO pageReqVO); + + /** + * 通过合同ID获得收发货规则 + * + * @param contractId 合同号 + * @return 收发货规则 + */ + List getContractReceiveSendListByContractId(Long contractId); + +} \ No newline at end of file diff --git a/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/service/contractreceivesend/ContractReceiveSendServiceImpl.java b/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/service/contractreceivesend/ContractReceiveSendServiceImpl.java new file mode 100644 index 00000000..1ee2b5a6 --- /dev/null +++ b/zt-module-contract-order/zt-module-contract-order-server/src/main/java/com/zt/plat/module/contractorder/service/contractreceivesend/ContractReceiveSendServiceImpl.java @@ -0,0 +1,96 @@ +package com.zt.plat.module.contractorder.service.contractreceivesend; + +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.contractorder.api.vo.contract.ContractReceiveSendPageReqVO; +import com.zt.plat.module.contractorder.api.vo.contract.ContractReceiveSendRespVO; +import com.zt.plat.module.contractorder.api.vo.contract.ContractReceiveSendSaveReqVO; +import com.zt.plat.module.contractorder.dal.dataobject.contractreceivesend.ContractReceiveSendDO; +import com.zt.plat.module.contractorder.dal.mysql.contractreceivesend.ContractReceiveSendMapper; +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 java.util.List; + +import static com.zt.plat.module.contractorder.enums.ErrorCodeConstants.CONTRACT_RECEIVE_SEND_NOT_EXISTS; + + +/** + * 收发货规则 Service 实现类 + * + * @author 后台管理-1 + */ +@Service +@Validated +public class ContractReceiveSendServiceImpl implements ContractReceiveSendService { + + @Resource + private ContractReceiveSendMapper contractReceiveSendMapper; + + @Override + public ContractReceiveSendRespVO createContractReceiveSend(ContractReceiveSendSaveReqVO createReqVO) { + // 插入 + ContractReceiveSendDO contractReceiveSend = BeanUtils.toBean(createReqVO, ContractReceiveSendDO.class); + contractReceiveSendMapper.insert(contractReceiveSend); + // 返回 + return BeanUtils.toBean(contractReceiveSend, ContractReceiveSendRespVO.class); + } + + @Override + public void updateContractReceiveSend(ContractReceiveSendSaveReqVO updateReqVO) { + // 校验存在 + validateContractReceiveSendExists(updateReqVO.getId()); + // 更新 + ContractReceiveSendDO updateObj = BeanUtils.toBean(updateReqVO, ContractReceiveSendDO.class); + contractReceiveSendMapper.updateById(updateObj); + } + + @Override + public void deleteContractReceiveSend(Long id) { + // 校验存在 + validateContractReceiveSendExists(id); + // 删除 + contractReceiveSendMapper.deleteById(id); + } + + @Override + public void deleteContractReceiveSendListByIds(List ids) { + // 校验存在 + validateContractReceiveSendExists(ids); + // 删除 + contractReceiveSendMapper.deleteByIds(ids); + } + + private void validateContractReceiveSendExists(List ids) { + List list = contractReceiveSendMapper.selectByIds(ids); + if (CollUtil.isEmpty(list) || list.size() != ids.size()) { + throw exception(CONTRACT_RECEIVE_SEND_NOT_EXISTS); + } + } + + private void validateContractReceiveSendExists(Long id) { + if (contractReceiveSendMapper.selectById(id) == null) { + throw exception(CONTRACT_RECEIVE_SEND_NOT_EXISTS); + } + } + + @Override + public ContractReceiveSendDO getContractReceiveSend(Long id) { + return contractReceiveSendMapper.selectById(id); + } + + @Override + public PageResult getContractReceiveSendPage(ContractReceiveSendPageReqVO pageReqVO) { + return contractReceiveSendMapper.selectPage(pageReqVO); + } + + @Override + public List getContractReceiveSendListByContractId(Long contractId) { + return BeanUtils.toBean(contractReceiveSendMapper.selectList(ContractReceiveSendDO::getContractId, contractId), ContractReceiveSendRespVO.class); + } + +} \ No newline at end of file diff --git a/zt-module-contract-order/zt-module-contract-order-server/src/main/resources/mapper/contractreceivesend/ContractReceiveSendMapper.xml b/zt-module-contract-order/zt-module-contract-order-server/src/main/resources/mapper/contractreceivesend/ContractReceiveSendMapper.xml new file mode 100644 index 00000000..b6a34630 --- /dev/null +++ b/zt-module-contract-order/zt-module-contract-order-server/src/main/resources/mapper/contractreceivesend/ContractReceiveSendMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/zt-module-erp/zt-module-erp-server/src/main/java/com/zt/plat/module/erp/controller/admin/erp/ErpMaterialController.java b/zt-module-erp/zt-module-erp-server/src/main/java/com/zt/plat/module/erp/controller/admin/erp/ErpMaterialController.java index 31898868..5636aeed 100644 --- a/zt-module-erp/zt-module-erp-server/src/main/java/com/zt/plat/module/erp/controller/admin/erp/ErpMaterialController.java +++ b/zt-module-erp/zt-module-erp-server/src/main/java/com/zt/plat/module/erp/controller/admin/erp/ErpMaterialController.java @@ -140,25 +140,45 @@ public class ErpMaterialController { @GetMapping("/getErpMaterialById") @Operation(summary = "通过物料id查询物料详情") @PreAuthorize("@ss.hasPermission('sply:erp-material:query')") - public CommonResult getErpMaterialById(@RequestParam("id") Long id) { + public CommonResult getErpMaterialById(@RequestParam("id") Long id) { ErpMaterialDO erpMaterial = erpMaterialService.getErpMaterialById(id); return success(BeanUtils.toBean(erpMaterial, ErpMaterialRespVO.class)); } + //通过主物料查询子物料信息 - @GetMapping("/getErpMaterialByMainMaterialById") - @Operation(summary = "通过主物料查询子物料信息") - @PreAuthorize("@ss.hasPermission('sply:erp-material:query')") - public CommonResult> getErpMaterialByMainMaterial(@RequestParam("id") Long mainMaterialId) { - List erpMaterial = erpMaterialService.getErpMaterialByMainMaterial(mainMaterialId); - return success(BeanUtils.toBean(erpMaterial, ErpMaterialRespVO.class)); + @GetMapping("/getErpMaterialByMainMaterialById") + @Operation(summary = "通过主物料查询子物料信息") + @PreAuthorize("@ss.hasPermission('sply:erp-material:query')") + public CommonResult> getErpMaterialByMainMaterial(@RequestParam("id") Long mainMaterialId) { + List erpMaterial = erpMaterialService.getErpMaterialByMainMaterial(mainMaterialId); + return success(BeanUtils.toBean(erpMaterial, ErpMaterialRespVO.class)); } //查询物料 - @GetMapping("/api-erp-material") - @Operation(summary = "通过接口查询物料") - @PreAuthorize("@ss.hasPermission('sply:erp-material:query')") - public CommonResult> getErpMaterialByApi(@RequestBody MaterialInfomationPageReqDTO material) { - List erpMaterial = erpMaterialService.getErpMaterialByApi(material); - return success(BeanUtils.toBean(erpMaterial, ErpMaterialRespVO.class)); + @GetMapping("/api-erp-material") + @Operation(summary = "通过接口查询物料") + @PreAuthorize("@ss.hasPermission('sply:erp-material:query')") + public CommonResult> getErpMaterialByApi(@RequestBody MaterialInfomationPageReqDTO material) { + List erpMaterial = erpMaterialService.getErpMaterialByApi(material); + return success(BeanUtils.toBean(erpMaterial, ErpMaterialRespVO.class)); + } + + + //通过主物料查询子物料信息 + @GetMapping("/erpMaterial-mainMaterial-code") + @Operation(summary = "通过主物料编号查询子物料信息") + @PreAuthorize("@ss.hasPermission('sply:erp-material:query')") + public CommonResult> getErpMaterialByMainMaterialByCOde(String code) { + + return success(BeanUtils.toBean(List.of(new MaterialInfomationPageReqDTO()), ErpMaterialRespVO.class)); + } + + //查询物料 + @GetMapping("/api-erp-material-code") + @Operation(summary = "通过编号接口查询物料") + @PreAuthorize("@ss.hasPermission('sply:erp-material:query')") + public CommonResult> getErpMaterialByApiByCode(String code) { + + return success(BeanUtils.toBean(List.of(new MaterialInfomationPageReqDTO()), ErpMaterialRespVO.class)); } } \ No newline at end of file