合同数据结构修改、合同审核接口部分代码
This commit is contained in:
@@ -17,7 +17,8 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode CONTRACT_PAPER_NUMBER_EXISTS = new ErrorCode(1_027_000_002, "合同编号已存在");
|
||||
ErrorCode CONTRACT_NOT_EXISTS = new ErrorCode(1_027_000_003, "合同不存在");
|
||||
ErrorCode CONTRACT_ID_NOT_EXISTS = new ErrorCode(1_027_000_004, "合同主键为空");
|
||||
ErrorCode CONTRACT_STATUS_NOT_UPDATE = new ErrorCode(1_027_000_005, "{}合同不允许修改");
|
||||
ErrorCode CONTRACT_STATUS_NOT_UPDATE = new ErrorCode(1_027_000_005, "{}状态合同不允许修改");
|
||||
ErrorCode CONTRACT_DATA_NOT_EXISTS = new ErrorCode(1_027_000_006, "{}不存在");
|
||||
ErrorCode CONTRACT_STATUS_NOT_SUBMIT_APPROVAL = new ErrorCode(1_027_000_005, "{}合同不允许提交审核");
|
||||
ErrorCode CONTRACT_STATUS_NOT_SUBMIT_APPROVAL = new ErrorCode(1_027_000_007, "{}状态合同不允许提交审核");
|
||||
ErrorCode CONTRACT_STATUS_NOT_APPROVAL = new ErrorCode(1_027_000_008, "{}状态合同不允许审核");
|
||||
}
|
||||
|
||||
@@ -99,8 +99,8 @@ public class TableFieldConstants {
|
||||
public static final String BSE_CTRT_PLN_CTRT_DTL_ID = "CTRT_DTL_ID";
|
||||
|
||||
/* 价款结算条款表 */
|
||||
// 合同明细主键
|
||||
public static final String BSE_CTRT_FMU_CTRT_DTL_ID = "CTRT_DTL_ID";
|
||||
// 合同主键
|
||||
public static final String BSE_CTRT_FMU_CTRT_ID = "CTRT_ID";
|
||||
|
||||
/* 基础系数配置表 */
|
||||
// 条款主键
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.zt.plat.module.contractorder.enums.contract;
|
||||
|
||||
/**
|
||||
* 合同审核结果
|
||||
*/
|
||||
public enum AuditResultEnum {
|
||||
/**
|
||||
* 合同状态-草稿
|
||||
*/
|
||||
PASS("通过","PASS", null),
|
||||
/**
|
||||
* 合同状态-正在审核
|
||||
*/
|
||||
REJECT("驳回","REJECT",null);
|
||||
|
||||
AuditResultEnum(String label, String code, String remark) {
|
||||
this.label = label;
|
||||
this.code = code;
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
/**
|
||||
* 标签
|
||||
*/
|
||||
private final String label;
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
private final String code;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private final String remark;
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
}
|
||||
@@ -5,10 +5,7 @@ import com.zt.plat.framework.business.interceptor.BusinessControllerMarker;
|
||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||
import com.zt.plat.module.contractorder.controller.admin.contract.vo.contract.ContractPageReqVO;
|
||||
import com.zt.plat.module.contractorder.controller.admin.contract.vo.contract.ContractRespVO;
|
||||
import com.zt.plat.module.contractorder.controller.admin.contract.vo.contract.ContractSaveReqVO;
|
||||
import com.zt.plat.module.contractorder.controller.admin.contract.vo.contract.ContractViewRespVO;
|
||||
import com.zt.plat.module.contractorder.controller.admin.contract.vo.contract.*;
|
||||
import com.zt.plat.module.contractorder.dal.dataobject.contract.ContractMainDO;
|
||||
import com.zt.plat.module.contractorder.service.contract.ContractService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@@ -109,6 +106,14 @@ public class ContractController implements BusinessControllerMarker {
|
||||
return success(contractService.submitApproval(id));
|
||||
}
|
||||
|
||||
// TODO
|
||||
@PostMapping("/approval")
|
||||
@Operation(summary = "合同审批")
|
||||
@PreAuthorize("@ss.hasPermission('system:contract:approval')")
|
||||
public CommonResult<String> approval(@Valid @RequestBody ContractApprovalReqVO reqVO) {
|
||||
return success(contractService.approval(reqVO));
|
||||
}
|
||||
|
||||
// TODO
|
||||
@PostMapping("/view/approval")
|
||||
@Operation(summary = "查看审批")
|
||||
@@ -117,9 +122,9 @@ public class ContractController implements BusinessControllerMarker {
|
||||
}
|
||||
|
||||
// TODO
|
||||
@PostMapping("/submit/ERP")
|
||||
@PostMapping("/submit/erp")
|
||||
@Operation(summary = "提交ERP")
|
||||
@PreAuthorize("@ss.hasPermission('system:contract:erp')")
|
||||
public void submitERP() {
|
||||
public void submitErp() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.zt.plat.module.contractorder.controller.admin.contract.vo.contract;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 合同审核请求对象 Request VO")
|
||||
@Data
|
||||
public class ContractApprovalReqVO {
|
||||
|
||||
@Schema(description = "合同主键ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "合同主键ID不能为空")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "审核结果(通过:PASS,驳回:REJECT)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "审核结果不能为空")
|
||||
private String auditResult;
|
||||
|
||||
@Schema(description = "审批意见", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "审核意见不能为空")
|
||||
private String reviewOpinion;
|
||||
}
|
||||
@@ -42,7 +42,4 @@ public class ContractDetailSaveReqVO {
|
||||
|
||||
// 交货计划
|
||||
private List<ContractPlanSaveReqVO> plans;
|
||||
|
||||
// 价款结算条款
|
||||
private List<ContractFormulaSaveReqVO> formulas;
|
||||
}
|
||||
@@ -10,14 +10,14 @@ import java.util.List;
|
||||
@Data
|
||||
public class ContractFormulaSaveReqVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "28539")
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "22933")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "合同明细主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "8181")
|
||||
@NotNull(message = "合同明细主键不能为空")
|
||||
private Long contractDetailId;
|
||||
@Schema(description = "合同主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "9162")
|
||||
@NotNull(message = "合同主键不能为空")
|
||||
private Long contractId;
|
||||
|
||||
@Schema(description = "公式类型;单价/总价/水扣款/加工费", example = "UNIT_PRICE")
|
||||
@Schema(description = "公式类型;单价/总价/水扣款/加工费", example = "1")
|
||||
private String formulaType;
|
||||
|
||||
@Schema(description = "公式")
|
||||
@@ -26,7 +26,7 @@ public class ContractFormulaSaveReqVO {
|
||||
@Schema(description = "编码公式")
|
||||
private String numberFormula;
|
||||
|
||||
@Schema(description = "物料名称", example = "物料名称")
|
||||
@Schema(description = "物料名称", example = "赵六")
|
||||
private String materialName;
|
||||
|
||||
@Schema(description = "物料编码")
|
||||
@@ -41,10 +41,10 @@ public class ContractFormulaSaveReqVO {
|
||||
@Schema(description = "金属元素缩写")
|
||||
private String elementAbbreviation;
|
||||
|
||||
@Schema(description = "金属元素名称", example = "金属元素名称")
|
||||
@Schema(description = "金属元素名称", example = "赵六")
|
||||
private String elementName;
|
||||
|
||||
@Schema(description = "结算类型,多条使用逗号分隔(字典:PRCH_STLM_TP)", example = "LST")
|
||||
@Schema(description = "结算类型,多条使用逗号分隔(字典:PRCH_STLM_TP)", example = "1")
|
||||
private String settlementType;
|
||||
|
||||
// 基础系数配置
|
||||
|
||||
@@ -214,4 +214,7 @@ public class ContractSaveReqVO {
|
||||
|
||||
// 合同动态表单
|
||||
private List<TemplateInstanceDataSaveReqVO> dynamicsFields;
|
||||
|
||||
// 价款结算条款
|
||||
private List<ContractFormulaSaveReqVO> formulas;
|
||||
}
|
||||
@@ -38,7 +38,4 @@ public class ContractViewDetailRespVO {
|
||||
|
||||
// 交货计划
|
||||
private List<ContractViewPlanRespVO> plans;
|
||||
|
||||
// 价款结算条款
|
||||
private List<ContractViewFormulaRespVO> formulas;
|
||||
}
|
||||
|
||||
@@ -8,13 +8,13 @@ import java.util.List;
|
||||
@Schema(description = "管理后台 - 价款结算条款 Response VO")
|
||||
@Data
|
||||
public class ContractViewFormulaRespVO {
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "28539")
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "22933")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "合同明细主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "8181")
|
||||
private Long contractDetailId;
|
||||
@Schema(description = "合同主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "9162")
|
||||
private Long contractId;
|
||||
|
||||
@Schema(description = "公式类型;单价/总价/水扣款/加工费", example = "UNIT_PRICE")
|
||||
@Schema(description = "公式类型;单价/总价/水扣款/加工费", example = "1")
|
||||
private String formulaType;
|
||||
|
||||
@Schema(description = "公式")
|
||||
@@ -23,7 +23,7 @@ public class ContractViewFormulaRespVO {
|
||||
@Schema(description = "编码公式")
|
||||
private String numberFormula;
|
||||
|
||||
@Schema(description = "物料名称", example = "物料名称")
|
||||
@Schema(description = "物料名称", example = "赵六")
|
||||
private String materialName;
|
||||
|
||||
@Schema(description = "物料编码")
|
||||
@@ -38,9 +38,12 @@ public class ContractViewFormulaRespVO {
|
||||
@Schema(description = "金属元素缩写")
|
||||
private String elementAbbreviation;
|
||||
|
||||
@Schema(description = "金属元素名称", example = "金属元素名称")
|
||||
@Schema(description = "金属元素名称", example = "赵六")
|
||||
private String elementName;
|
||||
|
||||
@Schema(description = "结算类型,多条使用逗号分隔(字典:PRCH_STLM_TP)", example = "1")
|
||||
private String settlementType;
|
||||
|
||||
// 基础系数配置
|
||||
private List<ContractViewCoefficientRespVO> coefficients;
|
||||
// 品位等级价配置
|
||||
|
||||
@@ -300,4 +300,7 @@ public class ContractViewRespVO {
|
||||
|
||||
// 合同动态条款
|
||||
private List<TemplateInstanceItemRespVO> dynamicsItems;
|
||||
|
||||
// 价款结算条款
|
||||
private List<ContractViewFormulaRespVO> formulas;
|
||||
}
|
||||
|
||||
@@ -28,10 +28,10 @@ public class ContractFormulaDO extends BusinessBaseDO {
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
/**
|
||||
* 合同明细主键
|
||||
* 合同主键
|
||||
*/
|
||||
@TableField("CTRT_DTL_ID")
|
||||
private Long contractDetailId;
|
||||
@TableField("CTRT_ID")
|
||||
private Long contractId;
|
||||
/**
|
||||
* 公式类型;单价/总价/水扣款/加工费
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.zt.plat.module.contractorder.service.contract;
|
||||
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.module.contractorder.controller.admin.contract.vo.contract.ContractApprovalReqVO;
|
||||
import com.zt.plat.module.contractorder.controller.admin.contract.vo.contract.ContractPageReqVO;
|
||||
import com.zt.plat.module.contractorder.controller.admin.contract.vo.contract.ContractSaveReqVO;
|
||||
import com.zt.plat.module.contractorder.controller.admin.contract.vo.contract.ContractViewRespVO;
|
||||
@@ -53,4 +54,6 @@ public interface ContractService {
|
||||
* @return 审批结果
|
||||
*/
|
||||
String submitApproval(Long id);
|
||||
|
||||
String approval(@Valid ContractApprovalReqVO reqVO);
|
||||
}
|
||||
|
||||
@@ -142,14 +142,16 @@ public class ContractServiceImpl implements ContractService {
|
||||
contractPlanMapper.insert(planDO);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 价款结算条款
|
||||
if (detail.getFormulas() != null && !detail.getFormulas().isEmpty()) {
|
||||
detail.getFormulas().forEach(formula -> {
|
||||
if (reqVO.getFormulas() != null && !reqVO.getFormulas().isEmpty()) {
|
||||
reqVO.getFormulas().forEach(formula -> {
|
||||
// 价款结算条款DO
|
||||
ContractFormulaDO formulaDO = BeanUtils.toBean(formula, ContractFormulaDO.class);
|
||||
// 合同明细主键
|
||||
formulaDO.setContractDetailId(detailDOId);
|
||||
// 合同主键
|
||||
formulaDO.setContractId(contractId);
|
||||
// 保存价款结算条款
|
||||
contractFormulaMapper.insert(formulaDO);
|
||||
|
||||
@@ -212,8 +214,6 @@ public class ContractServiceImpl implements ContractService {
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 合同动态表单
|
||||
List<TemplateInstanceDataDO> templateInstanceDataDOS = new ArrayList<>();
|
||||
@@ -259,14 +259,16 @@ public class ContractServiceImpl implements ContractService {
|
||||
if (planDOS != null && !planDOS.isEmpty()) {
|
||||
detail.setPlans(BeanUtils.toBean(planDOS, ContractViewPlanRespVO.class));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 查询并设置价款结算条款
|
||||
List<ContractFormulaDO> formulaDOS = contractFormulaMapper
|
||||
.selectList(TableFieldConstants.BSE_CTRT_FMU_CTRT_DTL_ID, detail.getId());
|
||||
.selectList(TableFieldConstants.BSE_CTRT_FMU_CTRT_ID, contractMainDO.getId());
|
||||
if (formulaDOS != null && !formulaDOS.isEmpty()) {
|
||||
detail.setFormulas(BeanUtils.toBean(formulaDOS, ContractViewFormulaRespVO.class));
|
||||
respVO.setFormulas(BeanUtils.toBean(formulaDOS, ContractViewFormulaRespVO.class));
|
||||
|
||||
detail.getFormulas().forEach(formula -> {
|
||||
respVO.getFormulas().forEach(formula -> {
|
||||
|
||||
// 查询并设置基础系数配置
|
||||
List<ContractCoefficientDO> coefficientDOS = contractCoefficientMapper
|
||||
@@ -300,8 +302,6 @@ public class ContractServiceImpl implements ContractService {
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 查询并设置合同动态表单
|
||||
List<TemplateInstanceDataDO> templateInstanceDataDOS = templateInstanceDataMapper
|
||||
@@ -378,10 +378,15 @@ public class ContractServiceImpl implements ContractService {
|
||||
|
||||
// 删除交货计划
|
||||
contractPlanMapper.delete(TableFieldConstants.BSE_CTRT_PLN_CTRT_DTL_ID, detailDOId.toString());
|
||||
});
|
||||
|
||||
// 删除合同明细
|
||||
contractDetailMapper.delete(TableFieldConstants.BSE_CTRT_DTL_CTRT_MAIN_ID, id.toString());
|
||||
}
|
||||
|
||||
// 查询价款结算条款
|
||||
List<ContractFormulaDO> formulaDOS = contractFormulaMapper
|
||||
.selectList(TableFieldConstants.BSE_CTRT_FMU_CTRT_DTL_ID, detailDOId.toString());
|
||||
.selectList(TableFieldConstants.BSE_CTRT_FMU_CTRT_ID, id);
|
||||
if (formulaDOS != null && !formulaDOS.isEmpty()) {
|
||||
formulaDOS.forEach(formulaDO -> {
|
||||
|
||||
@@ -399,14 +404,9 @@ public class ContractServiceImpl implements ContractService {
|
||||
// 删除品位不计价配置
|
||||
contractNotMapper.delete(TableFieldConstants.BSE_CTRT_NT_FMU_ID, formulaDOId.toString());
|
||||
});
|
||||
}
|
||||
|
||||
// 删除价款结算条款
|
||||
contractFormulaMapper.delete(TableFieldConstants.BSE_CTRT_FMU_CTRT_DTL_ID, detailDOId.toString());
|
||||
});
|
||||
|
||||
// 删除合同明细
|
||||
contractDetailMapper.delete(TableFieldConstants.BSE_CTRT_DTL_CTRT_MAIN_ID, id.toString());
|
||||
contractFormulaMapper.delete(TableFieldConstants.BSE_CTRT_FMU_CTRT_ID, id.toString());
|
||||
}
|
||||
|
||||
// 重新插入关联信息
|
||||
@@ -432,14 +432,16 @@ public class ContractServiceImpl implements ContractService {
|
||||
contractPlanMapper.insert(planDO);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 价款结算条款
|
||||
if (detail.getFormulas() != null && !detail.getFormulas().isEmpty()) {
|
||||
detail.getFormulas().forEach(formula -> {
|
||||
if (reqVO.getFormulas() != null && !reqVO.getFormulas().isEmpty()) {
|
||||
reqVO.getFormulas().forEach(formula -> {
|
||||
// 价款结算条款DO
|
||||
ContractFormulaDO formulaDO = BeanUtils.toBean(formula, ContractFormulaDO.class);
|
||||
// 合同明细主键
|
||||
formulaDO.setContractDetailId(detailDOId);
|
||||
// 合同主键
|
||||
formulaDO.setContractId(id);
|
||||
// 保存价款结算条款
|
||||
contractFormulaMapper.insert(formulaDO);
|
||||
|
||||
@@ -502,8 +504,6 @@ public class ContractServiceImpl implements ContractService {
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 合同动态表单
|
||||
List<TemplateInstanceDataDO> templateInstanceDataDOS = new ArrayList<>();
|
||||
@@ -561,13 +561,21 @@ public class ContractServiceImpl implements ContractService {
|
||||
AdminUserRespDTO adminUserRespDTO = adminUserApi
|
||||
.getUser(SecurityFrameworkUtils.getLoginUserId()).getData();
|
||||
|
||||
// 先创建流程,后更新状态
|
||||
if (StringUtils.isNotBlank(contractMainDO.getProcessInstanceId())) {
|
||||
|
||||
// TODO:驳回状态重新提交审批处理
|
||||
// 进入审批流程的合同,查询当前审批的任务节点
|
||||
List<BpmTaskRespDTO> taskList = bpmTaskApi.getTaskListByProcessInstanceId(contractMainDO.getProcessInstanceId()).getData();
|
||||
} else {
|
||||
|
||||
// 未进入审批流程的合同,创建审批流程
|
||||
BpmProcessInstanceCreateReqDTO pidto = new BpmProcessInstanceCreateReqDTO();
|
||||
pidto.setProcessDefinitionKey(ProcessConstants.CONTRACT_APPROVAL_PROCESS);
|
||||
pidto.setBusinessKey(String.valueOf(id));
|
||||
String data = bpmProcessInstanceApi.createProcessInstance(adminUserRespDTO.getId(), pidto).getData();
|
||||
if (StringUtils.isNotBlank(data)) {
|
||||
// 获取流程当前审批的任务节点
|
||||
|
||||
// 获取流程当前审批的任务节点,更新合同审批状态
|
||||
List<BpmTaskRespDTO> taskList = bpmTaskApi.getTaskListByProcessInstanceId(data).getData();
|
||||
contractMainDO.setProcessInstanceId(data);
|
||||
if (CollectionUtils.isNotEmpty(taskList)) {
|
||||
@@ -578,10 +586,43 @@ public class ContractServiceImpl implements ContractService {
|
||||
contractMainMapper.updateById(contractMainDO);
|
||||
return "提交审批成功";
|
||||
}
|
||||
}
|
||||
|
||||
return "提交审批失败";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String approval(ContractApprovalReqVO reqVO) {
|
||||
|
||||
// 合同主键ID
|
||||
Long id = reqVO.getId();
|
||||
|
||||
// 判断主键
|
||||
if (ObjectUtils.isEmpty(id)) {
|
||||
throw exception(CONTRACT_ID_NOT_EXISTS);
|
||||
}
|
||||
|
||||
// 查询合同是否存在
|
||||
ContractMainDO contractMainDO = contractMainMapper.selectById(id);
|
||||
if (contractMainDO == null) {
|
||||
throw exception(CONTRACT_NOT_EXISTS);
|
||||
}
|
||||
|
||||
// 合同状态校验
|
||||
if (ContractStatusEnum.DRAFT.getCode().equals(contractMainDO.getStatus())
|
||||
|| ContractStatusEnum.IN_PROGRESS.getCode().equals(contractMainDO.getStatus())
|
||||
|| ContractStatusEnum.REJECTED.getCode().equals(contractMainDO.getStatus())
|
||||
|| ContractStatusEnum.TERMINATED.getCode().equals(contractMainDO.getStatus())
|
||||
|| ContractStatusEnum.ARCHIVED.getCode().equals(contractMainDO.getStatus())
|
||||
|| ContractStatusEnum.DELETED.getCode().equals(contractMainDO.getStatus())) {
|
||||
|
||||
throw exception(CONTRACT_STATUS_NOT_APPROVAL,
|
||||
ContractStatusEnum.valueOf(contractMainDO.getStatus()).getLabel());
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验合同内容
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user