合同主信息字段添加、合同提交审核校验、合同新增接口修改
This commit is contained in:
@@ -19,4 +19,5 @@ public interface ErrorCodeConstants {
|
|||||||
ErrorCode CONTRACT_ID_NOT_EXISTS = new ErrorCode(1_027_000_004, "合同主键为空");
|
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_DATA_NOT_EXISTS = new ErrorCode(1_027_000_006, "{}不存在");
|
||||||
|
ErrorCode CONTRACT_STATUS_NOT_SUBMIT_APPROVAL = new ErrorCode(1_027_000_005, "{}合同不允许提交审核");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.zt.plat.module.contractorder.controller.admin.contract;
|
package com.zt.plat.module.contractorder.controller.admin.contract;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
import com.zt.plat.framework.business.interceptor.BusinessControllerMarker;
|
import com.zt.plat.framework.business.interceptor.BusinessControllerMarker;
|
||||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||||
import com.zt.plat.framework.common.pojo.PageResult;
|
import com.zt.plat.framework.common.pojo.PageResult;
|
||||||
@@ -43,9 +44,9 @@ public class ContractController implements BusinessControllerMarker {
|
|||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
@Operation(summary = "新增合同")
|
@Operation(summary = "新增合同")
|
||||||
@PreAuthorize("@ss.hasPermission('system:contract:create')")
|
@PreAuthorize("@ss.hasPermission('system:contract:create')")
|
||||||
public CommonResult<Long> create(@Valid @RequestBody ContractSaveReqVO reqVO) {
|
public CommonResult<JSONObject> create(@Valid @RequestBody ContractSaveReqVO reqVO) {
|
||||||
Long id = contractService.createContract(reqVO);
|
Long id = contractService.createContract(reqVO);
|
||||||
return success(id);
|
return success(new JSONObject().putOnce("id", id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/get")
|
@GetMapping("/get")
|
||||||
@@ -101,7 +102,6 @@ public class ContractController implements BusinessControllerMarker {
|
|||||||
public void archive() {
|
public void archive() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
|
||||||
@GetMapping("/submit/approval")
|
@GetMapping("/submit/approval")
|
||||||
@Operation(summary = "合同提交审批")
|
@Operation(summary = "合同提交审批")
|
||||||
@PreAuthorize("@ss.hasPermission('system:contract:approval')")
|
@PreAuthorize("@ss.hasPermission('system:contract:approval')")
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ public class ContractPageReqVO extends PageParam {
|
|||||||
@Schema(description = "合同编号;与ERP(HTBH)对应,校验唯一")
|
@Schema(description = "合同编号;与ERP(HTBH)对应,校验唯一")
|
||||||
private String contractPaperNumber;
|
private String contractPaperNumber;
|
||||||
|
|
||||||
|
@Schema(description = "状态", example = "DRAFT")
|
||||||
|
private String status;
|
||||||
|
|
||||||
@Schema(description = "甲方公司名称", example = "王五")
|
@Schema(description = "甲方公司名称", example = "王五")
|
||||||
private String purchaseCompanyName;
|
private String purchaseCompanyName;
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -304,4 +304,64 @@ public class ContractMainDO extends BusinessBaseDO {
|
|||||||
*/
|
*/
|
||||||
@TableField("FILE_OBJ_OTH")
|
@TableField("FILE_OBJ_OTH")
|
||||||
private String fileObjectOther;
|
private String fileObjectOther;
|
||||||
|
/**
|
||||||
|
* 交货地点
|
||||||
|
*/
|
||||||
|
@TableField("DLVY_ADR")
|
||||||
|
private String deliveryAddress;
|
||||||
|
/**
|
||||||
|
* 交货方式(字典:FRCST_ASN)
|
||||||
|
*/
|
||||||
|
@TableField("DLVY_WY")
|
||||||
|
private String deliveryWay;
|
||||||
|
/**
|
||||||
|
* 甲方联系人
|
||||||
|
*/
|
||||||
|
@TableField("PRCH_HMN")
|
||||||
|
private String purchaseHuman;
|
||||||
|
/**
|
||||||
|
* 甲方电话
|
||||||
|
*/
|
||||||
|
@TableField("PRCH_TEL")
|
||||||
|
private String purchaseTel;
|
||||||
|
/**
|
||||||
|
* 甲方邮箱
|
||||||
|
*/
|
||||||
|
@TableField("PRCH_EM")
|
||||||
|
private String purchaseEmail;
|
||||||
|
/**
|
||||||
|
* 甲方传真
|
||||||
|
*/
|
||||||
|
@TableField("PRCH_FAX")
|
||||||
|
private String purchaseFax;
|
||||||
|
/**
|
||||||
|
* 甲方联系地址
|
||||||
|
*/
|
||||||
|
@TableField("PRCH_CTCT_ADR")
|
||||||
|
private String purchaseContactAddress;
|
||||||
|
/**
|
||||||
|
* 乙方联系人
|
||||||
|
*/
|
||||||
|
@TableField("SALE_HMN")
|
||||||
|
private String salesHuman;
|
||||||
|
/**
|
||||||
|
* 乙方电话
|
||||||
|
*/
|
||||||
|
@TableField("SALE_TEL")
|
||||||
|
private String salesTel;
|
||||||
|
/**
|
||||||
|
* 乙方邮箱
|
||||||
|
*/
|
||||||
|
@TableField("SALE_EM")
|
||||||
|
private String salesEmail;
|
||||||
|
/**
|
||||||
|
* 乙方传真
|
||||||
|
*/
|
||||||
|
@TableField("SALE_FAX")
|
||||||
|
private String salesFax;
|
||||||
|
/**
|
||||||
|
* 乙方联系地址
|
||||||
|
*/
|
||||||
|
@TableField("SALE_CTCT_ADR")
|
||||||
|
private String salesContactAddress;
|
||||||
}
|
}
|
||||||
@@ -22,6 +22,7 @@ public interface ContractMainMapper extends BaseMapperX<ContractMainDO> {
|
|||||||
.betweenIfPresent(ContractMainDO::getSignDate, reqVO.getSignDate())
|
.betweenIfPresent(ContractMainDO::getSignDate, reqVO.getSignDate())
|
||||||
.likeIfPresent(ContractMainDO::getPurchaseCompanyName, reqVO.getPurchaseCompanyName())
|
.likeIfPresent(ContractMainDO::getPurchaseCompanyName, reqVO.getPurchaseCompanyName())
|
||||||
.eqIfPresent(ContractMainDO::getBasicAmount, reqVO.getBasicAmount())
|
.eqIfPresent(ContractMainDO::getBasicAmount, reqVO.getBasicAmount())
|
||||||
|
.eqIfPresent(ContractMainDO::getStatus, reqVO.getStatus())
|
||||||
.orderByDesc(ContractMainDO::getCreateTime));
|
.orderByDesc(ContractMainDO::getCreateTime));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -543,10 +543,21 @@ public class ContractServiceImpl implements ContractService {
|
|||||||
throw exception(CONTRACT_NOT_EXISTS);
|
throw exception(CONTRACT_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 合同内容校验 TODO
|
// 合同状态校验
|
||||||
|
if (ContractStatusEnum.UNDER_REVIEW.getCode().equals(contractMainDO.getStatus())
|
||||||
|
|| ContractStatusEnum.IN_PROGRESS.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_SUBMIT_APPROVAL,
|
||||||
|
ContractStatusEnum.valueOf(contractMainDO.getStatus()).getLabel());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 合同内容校验
|
||||||
verifyContract(get(id));
|
verifyContract(get(id));
|
||||||
|
|
||||||
// 查询用户
|
// 查询登陆用户
|
||||||
AdminUserRespDTO adminUserRespDTO = adminUserApi
|
AdminUserRespDTO adminUserRespDTO = adminUserApi
|
||||||
.getUser(SecurityFrameworkUtils.getLoginUserId()).getData();
|
.getUser(SecurityFrameworkUtils.getLoginUserId()).getData();
|
||||||
|
|
||||||
@@ -571,6 +582,11 @@ public class ContractServiceImpl implements ContractService {
|
|||||||
return "提交审批失败";
|
return "提交审批失败";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验合同内容
|
||||||
|
*
|
||||||
|
* @param contract 合同数据
|
||||||
|
*/
|
||||||
private void verifyContract(ContractViewRespVO contract) {
|
private void verifyContract(ContractViewRespVO contract) {
|
||||||
|
|
||||||
/* 合同基本信息 */
|
/* 合同基本信息 */
|
||||||
@@ -703,9 +719,22 @@ public class ContractServiceImpl implements ContractService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* 物料信息 */
|
/* 物料信息 */
|
||||||
// 物料名称不能为空
|
if (contract.getDetail() != null && !contract.getDetail().isEmpty()) {
|
||||||
// 数量不能为空
|
contract.getDetail().forEach(detail -> {
|
||||||
// 计量单位不能为空
|
// 物料名称不能为空
|
||||||
|
if (StringUtils.isBlank(detail.getMaterialName())) {
|
||||||
|
throw exception(CONTRACT_DATA_NOT_EXISTS, TableFieldConstants.BSE_CTRT_DTL_MTRL_NAME_LABEL);
|
||||||
|
}
|
||||||
|
// 数量不能为空
|
||||||
|
if (detail.getQuantity() != null) {
|
||||||
|
throw exception(CONTRACT_DATA_NOT_EXISTS, TableFieldConstants.BSE_CTRT_DTL_QTY_LABEL);
|
||||||
|
}
|
||||||
|
// 计量单位不能为空
|
||||||
|
if (StringUtils.isBlank(detail.getUnit())) {
|
||||||
|
throw exception(CONTRACT_DATA_NOT_EXISTS, TableFieldConstants.BSE_CTRT_DTL_UNT_LABEL);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/* 扩展信息 */
|
/* 扩展信息 */
|
||||||
// 是否框架合同不能为空
|
// 是否框架合同不能为空
|
||||||
|
|||||||
Reference in New Issue
Block a user