合同类型添加其他

This commit is contained in:
秦鸿展
2026-06-11 18:34:18 +08:00
parent daf4faf890
commit f79084ed58
8 changed files with 54 additions and 57 deletions
@@ -54,8 +54,8 @@ public class ContractManagePO extends BaseVOEntity{
@Excel(name = "是否通用合同", readConverterExp = "1=-是,2-否")
private Integer commonContractFlag;
@ApiModelProperty("合同类型(1-仓储,2-运输)")
@Excel(name = "合同类型", readConverterExp = "1=-仓储,2-运输")
@ApiModelProperty("合同类型(1-仓储,2-运输3-其他")
@Excel(name = "合同类型", readConverterExp = "1=-仓储,2-运输3=-其他")
private Integer contractType;
@ApiModelProperty("合同状态(1-未生效,2-使用中,3-已过期,4-已作废)")
@@ -590,6 +590,7 @@ public class ContractManageApplicationService {
if (ObjectUtil.isNull(loginUser)) {
throw new DigitalLogisticsException(UserError.TIMEOUT);
}
validateContractType(contractManageDO.getContractType());
/*
通用合同:同一时间段、同一合同类型,只能存在一个
特殊合同:同一结算主体、同一时间段、同一合同类型,只能存在一个
@@ -666,6 +667,29 @@ public class ContractManageApplicationService {
}
/**
* 校验合同类型
*/
private void validateContractType(Integer contractType) {
if (contractType == null) {
throw new ServiceException("合同类型不能为空");
}
if (contractType != 1 && contractType != 2 && contractType != 3) {
throw new ServiceException("合同类型不正确,请选择1-仓储、2-运输或3-其他");
}
}
/**
* 查询通用合同
*/
private ContractManagePO findGeneralContract(List<ContractManagePO> contractManagePOList, Integer contractType) {
return contractManagePOList.stream()
.filter(item -> Objects.equals(item.getContractType(), contractType)
&& item.getCommonContractFlag() == 1
&& item.getContractState() == 2)
.findFirst().orElse(null);
}
/**
* 校验合同是否合法
* @param contractManageDO
@@ -806,6 +830,7 @@ public class ContractManageApplicationService {
*/
@Transactional
public Boolean update(ContractManageDO contractManageDO) {
validateContractType(contractManageDO.getContractType());
checkContract(contractManageDO);
handleData(contractManageDO);
handleDetils(contractManageDO);
@@ -845,7 +870,7 @@ public class ContractManageApplicationService {
*/
public ContractManagePO getInfoByCustomer(String settlementCustomersCode,Integer contractType, Long topOrganizationId) {
/*
首先根据合同类型(仓储、运输),以及结算客户,查询合同信息
首先根据合同类型(仓储、运输、其他),以及结算客户,查询合同信息
如果传了结算主体,则根据结算主体以及当前时间查询有效的特殊合同,如果特殊合同没有,则查询通用合同
*/
//获取当前登录人信息
@@ -872,31 +897,12 @@ public class ContractManageApplicationService {
ContractManagePO contractManagePO = contractManagePOList.stream()
.filter(item -> item.getSettlementCustomersCode().equals(settlementCustomersCode) && Objects.equals(item.getContractType(), contractType)).findFirst().orElse(null);
if(null == contractManagePO){
if(contractType==1){
//仓储合同
resultContract = contractManagePOList.stream()
.filter(item ->
item.getContractType()==1 &&
item.getCommonContractFlag() == 1 && item.getContractState() ==2)
.findFirst().orElse(null);
}else{
//运输合同
resultContract = contractManagePOList.stream().filter(item -> item.getContractType()==2
&& item.getCommonContractFlag() == 1 && item.getContractState() ==2).findFirst().orElse(null);
}
resultContract = findGeneralContract(contractManagePOList, contractType);
}else {
resultContract = contractManagePO;
}
}else {
if(contractType==1){
//仓储合同
resultContract = contractManagePOList.stream().filter(contractManagePO -> contractManagePO.getContractType()==1
&& contractManagePO.getCommonContractFlag() == 1 && contractManagePO.getContractState() ==2).findFirst().orElse(null);
}else{
//运输合同
resultContract = contractManagePOList.stream().filter(contractManagePO -> contractManagePO.getContractType()==2
&& contractManagePO.getCommonContractFlag() == 1 && contractManagePO.getContractState() ==2).findFirst().orElse(null);
}
resultContract = findGeneralContract(contractManagePOList, contractType);
}
if(null == resultContract){
throw new ServiceException("找不到匹配的合同,请重试");
@@ -936,7 +942,7 @@ public class ContractManageApplicationService {
*/
public ContractManagePO getInfoByCustomerAndOrganizationId(String settlementCustomersCode,Integer contractType, Long topOrganizationId, Long organizationId) {
/*
首先根据合同类型(仓储、运输),以及结算客户,查询合同信息
首先根据合同类型(仓储、运输、其他),以及结算客户,查询合同信息
如果传了结算主体,则根据结算主体以及当前时间查询有效的特殊合同,如果特殊合同没有,则查询通用合同
*/
//获取当前登录人信息
@@ -966,31 +972,12 @@ public class ContractManageApplicationService {
ContractManagePO contractManagePO = contractManagePOList.stream()
.filter(item -> item.getSettlementCustomersCode().equals(settlementCustomersCode) && Objects.equals(item.getContractType(), contractType)).findFirst().orElse(null);
if(null == contractManagePO){
if(contractType==1){
//仓储合同
resultContract = contractManagePOList.stream()
.filter(item ->
item.getContractType()==1 &&
item.getCommonContractFlag() == 1 && item.getContractState() ==2)
.findFirst().orElse(null);
}else{
//运输合同
resultContract = contractManagePOList.stream().filter(item -> item.getContractType()==2
&& item.getCommonContractFlag() == 1 && item.getContractState() ==2).findFirst().orElse(null);
}
resultContract = findGeneralContract(contractManagePOList, contractType);
}else {
resultContract = contractManagePO;
}
}else {
if(contractType==1){
//仓储合同
resultContract = contractManagePOList.stream().filter(contractManagePO -> contractManagePO.getContractType()==1
&& contractManagePO.getCommonContractFlag() == 1 && contractManagePO.getContractState() ==2).findFirst().orElse(null);
}else{
//运输合同
resultContract = contractManagePOList.stream().filter(contractManagePO -> contractManagePO.getContractType()==2
&& contractManagePO.getCommonContractFlag() == 1 && contractManagePO.getContractState() ==2).findFirst().orElse(null);
}
resultContract = findGeneralContract(contractManagePOList, contractType);
}
if(null == resultContract){
throw new ServiceException("找不到匹配的合同,请重试");
@@ -56,8 +56,8 @@ public class ContractManage extends BaseVOEntity{
@Excel(name = "是否通用合同", readConverterExp = "1=-是,2-否")
private Integer commonContractFlag;
@ApiModelProperty("合同类型(1-仓储,2-运输)")
@Excel(name = "合同类型", readConverterExp = "1=-仓储,2-运输")
@ApiModelProperty("合同类型(1-仓储,2-运输3-其他")
@Excel(name = "合同类型", readConverterExp = "1=-仓储,2-运输3=-其他")
private Integer contractType;
@ApiModelProperty("合同状态(1-未生效,2-使用中,3-已过期,4-已作废)")
@@ -57,8 +57,8 @@ public class ContractManagePO extends BaseVOEntity{
@Excel(name = "是否通用合同", readConverterExp = "1=-是,2-否")
private Integer commonContractFlag;
@ApiModelProperty("合同类型(1-仓储,2-运输)")
@Excel(name = "合同类型", readConverterExp = "1=-仓储,2-运输")
@ApiModelProperty("合同类型(1-仓储,2-运输3-其他")
@Excel(name = "合同类型", readConverterExp = "1=-仓储,2-运输3=-其他")
private Integer contractType;
@ApiModelProperty("合同状态(1-未生效,2-使用中,3-已过期,4-已作废)")
@@ -54,8 +54,8 @@ public class ContractManageDO extends BaseVOEntity{
@Excel(name = "是否通用合同", readConverterExp = "1=-是,2-否")
private Integer commonContractFlag;
@ApiModelProperty("合同类型(1-仓储,2-运输)")
@Excel(name = "合同类型", readConverterExp = "1=-仓储,2-运输")
@ApiModelProperty("合同类型(1-仓储,2-运输3-其他")
@Excel(name = "合同类型", readConverterExp = "1=-仓储,2-运输3=-其他")
private Integer contractType;
@ApiModelProperty("合同状态(1-未生效,2-使用中,3-已过期,4-已作废)")
@@ -54,8 +54,8 @@ public class ContractManageDTO extends BaseVOEntity{
@Excel(name = "是否通用合同", readConverterExp = "1=-是,2-否")
private Integer commonContractFlag;
@ApiModelProperty("合同类型(1-仓储,2-运输)")
@Excel(name = "合同类型", readConverterExp = "1=-仓储,2-运输")
@ApiModelProperty("合同类型(1-仓储,2-运输3-其他")
@Excel(name = "合同类型", readConverterExp = "1=-仓储,2-运输3=-其他")
private Integer contractType;
@ApiModelProperty("合同状态(1-未生效,2-使用中,3-已过期,4-已作废)")
@@ -279,7 +279,17 @@ public class ReportFormApplicationService {
k.put("project_code",projectCode == null ? value : projectCode);
break;
case "contractType":
k.put("contract_type",ObjectUtil.equals(value,1) ? "仓储" : "运输");
String contractTypeName;
if (ObjectUtil.equals(value, 1)) {
contractTypeName = "仓储";
} else if (ObjectUtil.equals(value, 2)) {
contractTypeName = "运输";
} else if (ObjectUtil.equals(value, 3)) {
contractTypeName = "其他";
} else {
contractTypeName = String.valueOf(value);
}
k.put("contract_type", contractTypeName);
break;
case "organizationId":
String organizationId = v.stream().filter(item -> item.getOrganizationId()==Long.parseLong(value.toString())).findAny().map(BillingStatement::getOrganizationName).orElse(null);
@@ -54,8 +54,8 @@ public class ContractManagePO extends BaseVOEntity{
@Excel(name = "是否通用合同", readConverterExp = "1=-是,2-否")
private Integer commonContractFlag;
@ApiModelProperty("合同类型(1-仓储,2-运输)")
@Excel(name = "合同类型", readConverterExp = "1=-仓储,2-运输")
@ApiModelProperty("合同类型(1-仓储,2-运输3-其他")
@Excel(name = "合同类型", readConverterExp = "1=-仓储,2-运输3=-其他")
private Integer contractType;
@ApiModelProperty("合同状态(1-未生效,2-使用中,3-已过期,4-已作废)")