新增合同收发货规则
This commit is contained in:
@@ -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;
|
||||||
|
}
|
||||||
@@ -283,4 +283,6 @@ public class ContractRespDTO {
|
|||||||
|
|
||||||
// 品位不计价规则
|
// 品位不计价规则
|
||||||
private List<NotRespDTO> nots;
|
private List<NotRespDTO> nots;
|
||||||
|
//收发货规则
|
||||||
|
private List<ContractReceiveSendRespDTO> contractReceiveSends;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -272,6 +272,9 @@ public class ContractRespVO {
|
|||||||
@Schema(description = "乙方税号/社会信用代码")
|
@Schema(description = "乙方税号/社会信用代码")
|
||||||
private String salesTaxNumber;
|
private String salesTaxNumber;
|
||||||
|
|
||||||
|
@Schema(description = "是否信用", example = "1")
|
||||||
|
private String hasCredit;
|
||||||
|
|
||||||
// 物料信息
|
// 物料信息
|
||||||
private List<DetailRespVO> detail;
|
private List<DetailRespVO> detail;
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import jakarta.validation.constraints.NotNull;
|
|||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -241,6 +242,10 @@ public class ContractSaveReqVO {
|
|||||||
|
|
||||||
@Schema(description = "乙方税号/社会信用代码")
|
@Schema(description = "乙方税号/社会信用代码")
|
||||||
private String salesTaxNumber;
|
private String salesTaxNumber;
|
||||||
|
@Schema(description = "是否信用", example = "1")
|
||||||
|
private String hasCredit;
|
||||||
|
// 收发货规则
|
||||||
|
private List<ContractReceiveSendSaveReqVO> contractReceiveSends;
|
||||||
|
|
||||||
// 物料信息
|
// 物料信息
|
||||||
private List<DetailSaveReqVO> detail;
|
private List<DetailSaveReqVO> detail;
|
||||||
|
|||||||
@@ -32,4 +32,7 @@ public interface ErrorCodeConstants {
|
|||||||
ErrorCode CONTRACT_PARTNER_NOT_EXISTS = new ErrorCode(1_027_000_017, "客商信息不存在");
|
ErrorCode CONTRACT_PARTNER_NOT_EXISTS = new ErrorCode(1_027_000_017, "客商信息不存在");
|
||||||
ErrorCode CONTRACT_PUSH_FAIL = new ErrorCode(1_027_000_019, "推送合同失败:{}");
|
ErrorCode CONTRACT_PUSH_FAIL = new ErrorCode(1_027_000_019, "推送合同失败:{}");
|
||||||
ErrorCode CONTRACT_STATUS_NOT_CANCEL = new ErrorCode(1_027_000_020, "{}状态合同不允许作废");
|
ErrorCode CONTRACT_STATUS_NOT_CANCEL = new ErrorCode(1_027_000_020, "{}状态合同不允许作废");
|
||||||
|
|
||||||
|
ErrorCode CONTRACT_RECEIVE_SEND_NOT_EXISTS = new ErrorCode(1_027_000_021, "收发货规则不存在");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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<ContractReceiveSendRespVO> createContractReceiveSend(@Valid @RequestBody ContractReceiveSendSaveReqVO createReqVO) {
|
||||||
|
return success(contractReceiveSendService.createContractReceiveSend(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新收发货规则")
|
||||||
|
@PreAuthorize("@ss.hasPermission('bse:contract-receive-send:update')")
|
||||||
|
public CommonResult<Boolean> 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<Boolean> 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<Boolean> 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<ContractReceiveSendRespVO> 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<PageResult<ContractReceiveSendRespVO>> getContractReceiveSendPage(@Valid ContractReceiveSendPageReqVO pageReqVO) {
|
||||||
|
PageResult<ContractReceiveSendDO> 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<ContractReceiveSendDO> list = contractReceiveSendService.getContractReceiveSendPage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "收发货规则.xls", "数据", ContractReceiveSendRespVO.class,
|
||||||
|
BeanUtils.toBean(list, ContractReceiveSendRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -450,4 +450,9 @@ public class ContractMainDO extends BusinessBaseDO {
|
|||||||
*/
|
*/
|
||||||
@TableField("SALE_TAX_NUM")
|
@TableField("SALE_TAX_NUM")
|
||||||
private String salesTaxNumber;
|
private String salesTaxNumber;
|
||||||
|
/**
|
||||||
|
* 否启用授信
|
||||||
|
*/
|
||||||
|
@TableField("HS_CRDT")
|
||||||
|
private String hasCredit;
|
||||||
}
|
}
|
||||||
@@ -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;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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<ContractReceiveSendDO> {
|
||||||
|
|
||||||
|
default PageResult<ContractReceiveSendDO> selectPage(ContractReceiveSendPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<ContractReceiveSendDO>()
|
||||||
|
.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));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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.ProcessConstants;
|
||||||
import com.zt.plat.module.contractorder.enums.TableFieldConstants;
|
import com.zt.plat.module.contractorder.enums.TableFieldConstants;
|
||||||
import com.zt.plat.module.contractorder.enums.contract.DictEnum;
|
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.ErpContractPageReqVO;
|
||||||
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpContractSaveReqVO;
|
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpContractSaveReqVO;
|
||||||
import com.zt.plat.module.erp.dal.dataobject.erp.ErpContractDO;
|
import com.zt.plat.module.erp.dal.dataobject.erp.ErpContractDO;
|
||||||
@@ -118,6 +119,9 @@ public class ContractServiceImpl implements ContractService {
|
|||||||
@Resource
|
@Resource
|
||||||
private TmplInscItmBsnService tmplInscItmBsnService;
|
private TmplInscItmBsnService tmplInscItmBsnService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ContractReceiveSendService contractReceiveSendService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<ContractMainDO> getContractPage(ContractPageReqVO pageReqVO) {
|
public PageResult<ContractMainDO> getContractPage(ContractPageReqVO pageReqVO) {
|
||||||
return contractMainMapper.selectContractPage(pageReqVO);
|
return contractMainMapper.selectContractPage(pageReqVO);
|
||||||
@@ -177,7 +181,7 @@ public class ContractServiceImpl implements ContractService {
|
|||||||
// 合同明细ID
|
// 合同明细ID
|
||||||
Long detailDOId = detailDO.getId();
|
Long detailDOId = detailDO.getId();
|
||||||
// 交货计划
|
// 交货计划
|
||||||
if (detail.getPlans() != null && !detail.getPlans().isEmpty()) {
|
if (detail.getPlans() != null && !detail.getPlans().isEmpty()) {
|
||||||
detail.getPlans().forEach(plan -> {
|
detail.getPlans().forEach(plan -> {
|
||||||
// 交货计划DO
|
// 交货计划DO
|
||||||
ContractPlanDO planDO = BeanUtils.toBean(plan, ContractPlanDO.class);
|
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 -> {
|
formula.getPrices().forEach(price -> {
|
||||||
// 市场价配置DO
|
// 市场价配置DO
|
||||||
ContractPriceDO priceDO = BeanUtils.toBean(price, ContractPriceDO.class);
|
ContractPriceDO priceDO = BeanUtils.toBean(price, ContractPriceDO.class);
|
||||||
@@ -297,7 +301,13 @@ public class ContractServiceImpl implements ContractService {
|
|||||||
// });
|
// });
|
||||||
tmplInscItmBsnService.updateTmplInscItmBsnBatch(dynamicsItems);
|
tmplInscItmBsnService.updateTmplInscItmBsnBatch(dynamicsItems);
|
||||||
}
|
}
|
||||||
|
//插入收发货规则
|
||||||
|
if (reqVO.getContractReceiveSends() != null && !reqVO.getContractReceiveSends().isEmpty()) {
|
||||||
|
reqVO.getContractReceiveSends().forEach(contractReceiveSend -> {
|
||||||
|
contractReceiveSend.setContractId(contractId);
|
||||||
|
contractReceiveSendService.createContractReceiveSend(contractReceiveSend);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return contractId;
|
return contractId;
|
||||||
}
|
}
|
||||||
@@ -400,7 +410,7 @@ public class ContractServiceImpl implements ContractService {
|
|||||||
ContractRespVO respVO = new ContractRespVO();
|
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) {
|
if (contractMainDO == null) {
|
||||||
throw exception(CONTRACT_NOT_EXISTS);
|
throw exception(CONTRACT_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
@@ -504,7 +514,7 @@ public class ContractServiceImpl implements ContractService {
|
|||||||
// 已关联的上游合同id集合
|
// 已关联的上游合同id集合
|
||||||
List<SystemRelativityDO> systemRelativityDOS = systemRelativityMapper.selectList();
|
List<SystemRelativityDO> systemRelativityDOS = systemRelativityMapper.selectList();
|
||||||
LinkedHashSet<String> relationIds = new LinkedHashSet<>();
|
LinkedHashSet<String> relationIds = new LinkedHashSet<>();
|
||||||
if (systemRelativityDOS!= null && !systemRelativityDOS.isEmpty()) {
|
if (systemRelativityDOS != null && !systemRelativityDOS.isEmpty()) {
|
||||||
systemRelativityDOS.forEach(systemRelativityDO -> {
|
systemRelativityDOS.forEach(systemRelativityDO -> {
|
||||||
relationIds.add(systemRelativityDO.getUpId());
|
relationIds.add(systemRelativityDO.getUpId());
|
||||||
});
|
});
|
||||||
@@ -528,7 +538,7 @@ public class ContractServiceImpl implements ContractService {
|
|||||||
// 查询
|
// 查询
|
||||||
List<ContractMainDO> contractMainDOS = contractMainMapper.selectList(conditon);
|
List<ContractMainDO> contractMainDOS = contractMainMapper.selectList(conditon);
|
||||||
result = BeanUtils.toBean(contractMainDOS, ContractRespVO.class);
|
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)) {
|
if (StringUtils.isEmpty(salesCompanyNumber)) {
|
||||||
// 乙方公司编号不存在
|
// 乙方公司编号不存在
|
||||||
@@ -572,7 +582,7 @@ public class ContractServiceImpl implements ContractService {
|
|||||||
// 已关联的上游合同id集合
|
// 已关联的上游合同id集合
|
||||||
List<SystemRelativityDO> systemRelativityDOS = systemRelativityMapper.selectList();
|
List<SystemRelativityDO> systemRelativityDOS = systemRelativityMapper.selectList();
|
||||||
LinkedHashSet<String> relationIds = new LinkedHashSet<>();
|
LinkedHashSet<String> relationIds = new LinkedHashSet<>();
|
||||||
if (systemRelativityDOS!= null && !systemRelativityDOS.isEmpty()) {
|
if (systemRelativityDOS != null && !systemRelativityDOS.isEmpty()) {
|
||||||
systemRelativityDOS.forEach(systemRelativityDO -> {
|
systemRelativityDOS.forEach(systemRelativityDO -> {
|
||||||
relationIds.add(systemRelativityDO.getDownId());
|
relationIds.add(systemRelativityDO.getDownId());
|
||||||
});
|
});
|
||||||
@@ -596,7 +606,7 @@ public class ContractServiceImpl implements ContractService {
|
|||||||
// 查询
|
// 查询
|
||||||
List<ContractMainDO> contractMainDOS = contractMainMapper.selectList(conditon);
|
List<ContractMainDO> contractMainDOS = contractMainMapper.selectList(conditon);
|
||||||
result = BeanUtils.toBean(contractMainDOS, ContractRespVO.class);
|
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)) {
|
if (StringUtils.isEmpty(salesCompanyNumber)) {
|
||||||
// 乙方公司编号不存在
|
// 乙方公司编号不存在
|
||||||
@@ -790,7 +800,7 @@ public class ContractServiceImpl implements ContractService {
|
|||||||
// 合同明细ID
|
// 合同明细ID
|
||||||
Long detailDOId = detailDO.getId();
|
Long detailDOId = detailDO.getId();
|
||||||
// 交货计划
|
// 交货计划
|
||||||
if (detail.getPlans() != null && !detail.getPlans().isEmpty()) {
|
if (detail.getPlans() != null && !detail.getPlans().isEmpty()) {
|
||||||
detail.getPlans().forEach(plan -> {
|
detail.getPlans().forEach(plan -> {
|
||||||
// 交货计划DO
|
// 交货计划DO
|
||||||
ContractPlanDO planDO = BeanUtils.toBean(plan, ContractPlanDO.class);
|
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 -> {
|
formula.getPrices().forEach(price -> {
|
||||||
// 市场价配置DO
|
// 市场价配置DO
|
||||||
ContractPriceDO priceDO = BeanUtils.toBean(price, ContractPriceDO.class);
|
ContractPriceDO priceDO = BeanUtils.toBean(price, ContractPriceDO.class);
|
||||||
@@ -1369,6 +1379,9 @@ public class ContractServiceImpl implements ContractService {
|
|||||||
if (notDOS != null && !notDOS.isEmpty()) {
|
if (notDOS != null && !notDOS.isEmpty()) {
|
||||||
respDTO.setNots(BeanUtils.toBean(notDOS, NotRespDTO.class));
|
respDTO.setNots(BeanUtils.toBean(notDOS, NotRespDTO.class));
|
||||||
}
|
}
|
||||||
|
//收发货
|
||||||
|
List<ContractReceiveSendRespVO> contractReceiveSendListByContractId = contractReceiveSendService.getContractReceiveSendListByContractId(contractMainDO.getId());
|
||||||
|
respDTO.setContractReceiveSends(BeanUtils.toBean(contractReceiveSendListByContractId, ContractReceiveSendRespDTO.class));
|
||||||
|
|
||||||
return respDTO;
|
return respDTO;
|
||||||
}
|
}
|
||||||
@@ -1503,7 +1516,7 @@ public class ContractServiceImpl implements ContractService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 上传模板附件
|
// 上传模板附件
|
||||||
if(StringUtils.isNotBlank(contractMainDO.getFileObject())){
|
if (StringUtils.isNotBlank(contractMainDO.getFileObject())) {
|
||||||
JSONArray fileObjects = new JSONArray(contractMainDO.getFileObject());
|
JSONArray fileObjects = new JSONArray(contractMainDO.getFileObject());
|
||||||
for (int i = 0; i < fileObjects.size(); i++) {
|
for (int i = 0; i < fileObjects.size(); i++) {
|
||||||
JSONObject file = fileObjects.getJSONObject(i);
|
JSONObject file = fileObjects.getJSONObject(i);
|
||||||
@@ -1517,7 +1530,7 @@ public class ContractServiceImpl implements ContractService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 合同其它附件
|
// 合同其它附件
|
||||||
if(StringUtils.isNotBlank(contractMainDO.getFileObjectOther())){
|
if (StringUtils.isNotBlank(contractMainDO.getFileObjectOther())) {
|
||||||
JSONArray fileObjectOthers = new JSONArray(contractMainDO.getFileObjectOther());
|
JSONArray fileObjectOthers = new JSONArray(contractMainDO.getFileObjectOther());
|
||||||
for (int i = 0; i < fileObjectOthers.size(); i++) {
|
for (int i = 0; i < fileObjectOthers.size(); i++) {
|
||||||
JSONObject file = fileObjectOthers.getJSONObject(i);
|
JSONObject file = fileObjectOthers.getJSONObject(i);
|
||||||
@@ -1542,7 +1555,7 @@ public class ContractServiceImpl implements ContractService {
|
|||||||
|
|
||||||
zips.finish();
|
zips.finish();
|
||||||
return ResponseEntity.ok()
|
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)
|
.contentType(MediaType.APPLICATION_OCTET_STREAM)
|
||||||
.body(new ByteArrayResource(zipsByte.toByteArray()));
|
.body(new ByteArrayResource(zipsByte.toByteArray()));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -1665,7 +1678,7 @@ public class ContractServiceImpl implements ContractService {
|
|||||||
* @param contractMainDO 合同主信息
|
* @param contractMainDO 合同主信息
|
||||||
* @return 操作标识
|
* @return 操作标识
|
||||||
*/
|
*/
|
||||||
private String getOperationId(ContractMainDO contractMainDO){
|
private String getOperationId(ContractMainDO contractMainDO) {
|
||||||
String operationId = null;
|
String operationId = null;
|
||||||
|
|
||||||
// 1、先调用009ERP接口查询合同信息
|
// 1、先调用009ERP接口查询合同信息
|
||||||
@@ -2066,12 +2079,12 @@ public class ContractServiceImpl implements ContractService {
|
|||||||
// 单据名称(拼音)
|
// 单据名称(拼音)
|
||||||
String documentName = "XTHT";
|
String documentName = "XTHT";
|
||||||
// 公司编码
|
// 公司编码
|
||||||
String companyId = CompanyContextHolder.getCompanyId()!= null ? CompanyContextHolder.getCompanyId().toString() : "";
|
String companyId = CompanyContextHolder.getCompanyId() != null ? CompanyContextHolder.getCompanyId().toString() : "";
|
||||||
// 年月日
|
// 年月日
|
||||||
String yearMounth8Bit = LocalDate.now()
|
String yearMounth8Bit = LocalDate.now()
|
||||||
.format(DateTimeFormatter.ofPattern(DateConstants.DATE_FORMAT_YEAR_MONTH_DAY_8_BIT));
|
.format(DateTimeFormatter.ofPattern(DateConstants.DATE_FORMAT_YEAR_MONTH_DAY_8_BIT));
|
||||||
// 查询最大编号
|
// 查询最大编号
|
||||||
String numPrefix = documentName+"-"+category+"-"+companyId+"-"+yearMounth8Bit;
|
String numPrefix = documentName + "-" + category + "-" + companyId + "-" + yearMounth8Bit;
|
||||||
QueryWrapper<ContractMainDO> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<ContractMainDO> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.likeRight("SYS_CTRT_NUM", numPrefix);
|
queryWrapper.likeRight("SYS_CTRT_NUM", numPrefix);
|
||||||
queryWrapper.orderByDesc("SYS_CTRT_NUM");
|
queryWrapper.orderByDesc("SYS_CTRT_NUM");
|
||||||
@@ -2095,7 +2108,7 @@ public class ContractServiceImpl implements ContractService {
|
|||||||
/**
|
/**
|
||||||
* 获取合同ID集合
|
* 获取合同ID集合
|
||||||
*
|
*
|
||||||
* @param contractName 合同名称
|
* @param contractName 合同名称
|
||||||
* @param contractPaperNumber 合同编号
|
* @param contractPaperNumber 合同编号
|
||||||
* @return 合同ID集合
|
* @return 合同ID集合
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -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<Long> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得收发货规则
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 收发货规则
|
||||||
|
*/
|
||||||
|
ContractReceiveSendDO getContractReceiveSend(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得收发货规则分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 收发货规则分页
|
||||||
|
*/
|
||||||
|
PageResult<ContractReceiveSendDO> getContractReceiveSendPage(ContractReceiveSendPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过合同ID获得收发货规则
|
||||||
|
*
|
||||||
|
* @param contractId 合同号
|
||||||
|
* @return 收发货规则
|
||||||
|
*/
|
||||||
|
List<ContractReceiveSendRespVO> getContractReceiveSendListByContractId(Long contractId);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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<Long> ids) {
|
||||||
|
// 校验存在
|
||||||
|
validateContractReceiveSendExists(ids);
|
||||||
|
// 删除
|
||||||
|
contractReceiveSendMapper.deleteByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateContractReceiveSendExists(List<Long> ids) {
|
||||||
|
List<ContractReceiveSendDO> 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<ContractReceiveSendDO> getContractReceiveSendPage(ContractReceiveSendPageReqVO pageReqVO) {
|
||||||
|
return contractReceiveSendMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ContractReceiveSendRespVO> getContractReceiveSendListByContractId(Long contractId) {
|
||||||
|
return BeanUtils.toBean(contractReceiveSendMapper.selectList(ContractReceiveSendDO::getContractId, contractId), ContractReceiveSendRespVO.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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.bse.dal.dao.contractreceivesend.ContractReceiveSendMapper">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||||
|
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||||
|
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||||
|
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||||
|
-->
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -140,25 +140,45 @@ public class ErpMaterialController {
|
|||||||
@GetMapping("/getErpMaterialById")
|
@GetMapping("/getErpMaterialById")
|
||||||
@Operation(summary = "通过物料id查询物料详情")
|
@Operation(summary = "通过物料id查询物料详情")
|
||||||
@PreAuthorize("@ss.hasPermission('sply:erp-material:query')")
|
@PreAuthorize("@ss.hasPermission('sply:erp-material:query')")
|
||||||
public CommonResult<ErpMaterialRespVO> getErpMaterialById(@RequestParam("id") Long id) {
|
public CommonResult<ErpMaterialRespVO> getErpMaterialById(@RequestParam("id") Long id) {
|
||||||
ErpMaterialDO erpMaterial = erpMaterialService.getErpMaterialById(id);
|
ErpMaterialDO erpMaterial = erpMaterialService.getErpMaterialById(id);
|
||||||
return success(BeanUtils.toBean(erpMaterial, ErpMaterialRespVO.class));
|
return success(BeanUtils.toBean(erpMaterial, ErpMaterialRespVO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
//通过主物料查询子物料信息
|
//通过主物料查询子物料信息
|
||||||
@GetMapping("/getErpMaterialByMainMaterialById")
|
@GetMapping("/getErpMaterialByMainMaterialById")
|
||||||
@Operation(summary = "通过主物料查询子物料信息")
|
@Operation(summary = "通过主物料查询子物料信息")
|
||||||
@PreAuthorize("@ss.hasPermission('sply:erp-material:query')")
|
@PreAuthorize("@ss.hasPermission('sply:erp-material:query')")
|
||||||
public CommonResult<List<ErpMaterialRespVO>> getErpMaterialByMainMaterial(@RequestParam("id") Long mainMaterialId) {
|
public CommonResult<List<ErpMaterialRespVO>> getErpMaterialByMainMaterial(@RequestParam("id") Long mainMaterialId) {
|
||||||
List<ErpMaterialDO> erpMaterial = erpMaterialService.getErpMaterialByMainMaterial(mainMaterialId);
|
List<ErpMaterialDO> erpMaterial = erpMaterialService.getErpMaterialByMainMaterial(mainMaterialId);
|
||||||
return success(BeanUtils.toBean(erpMaterial, ErpMaterialRespVO.class));
|
return success(BeanUtils.toBean(erpMaterial, ErpMaterialRespVO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
//查询物料
|
//查询物料
|
||||||
@GetMapping("/api-erp-material")
|
@GetMapping("/api-erp-material")
|
||||||
@Operation(summary = "通过接口查询物料")
|
@Operation(summary = "通过接口查询物料")
|
||||||
@PreAuthorize("@ss.hasPermission('sply:erp-material:query')")
|
@PreAuthorize("@ss.hasPermission('sply:erp-material:query')")
|
||||||
public CommonResult<List<ErpMaterialRespVO>> getErpMaterialByApi(@RequestBody MaterialInfomationPageReqDTO material) {
|
public CommonResult<List<ErpMaterialRespVO>> getErpMaterialByApi(@RequestBody MaterialInfomationPageReqDTO material) {
|
||||||
List<ErpMaterialDO> erpMaterial = erpMaterialService.getErpMaterialByApi(material);
|
List<ErpMaterialDO> erpMaterial = erpMaterialService.getErpMaterialByApi(material);
|
||||||
return success(BeanUtils.toBean(erpMaterial, ErpMaterialRespVO.class));
|
return success(BeanUtils.toBean(erpMaterial, ErpMaterialRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//通过主物料查询子物料信息
|
||||||
|
@GetMapping("/erpMaterial-mainMaterial-code")
|
||||||
|
@Operation(summary = "通过主物料编号查询子物料信息")
|
||||||
|
@PreAuthorize("@ss.hasPermission('sply:erp-material:query')")
|
||||||
|
public CommonResult<List<ErpMaterialRespVO>> 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<List<ErpMaterialRespVO>> getErpMaterialByApiByCode(String code) {
|
||||||
|
|
||||||
|
return success(BeanUtils.toBean(List.of(new MaterialInfomationPageReqDTO()), ErpMaterialRespVO.class));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user