Commit 50e94d09 by liushaowei

bug修复

parent 7432a1b1
......@@ -500,7 +500,7 @@ public class ContractServiceImpl implements ContractService {
}
//补充协议
if("2".equals(resource.getContractType())){
if("2".equals(resource.getContractType()) && "tkio".equals(resource.getPlatform())){
//关联合同不能为空
if(null == resource.getRelationContract() || "".equals(resource.getRelationContract())|| -1L == resource.getRelationContract()){
Contract contractExist = new Contract();
......@@ -846,6 +846,25 @@ public class ContractServiceImpl implements ContractService {
Contract contract = contractRepository.findOne(resource.getId());
//补充协议
if("2".equals(contract.getContractType()) && "tkio".equals(contract.getPlatform())){
//关联合同不能为空
if(null == contract.getRelationContract() || "".equals(contract.getRelationContract())|| -1L == contract.getRelationContract()){
Contract contractExist = new Contract();
contractExist.setId(-100L);
contractExist.setErroMessage("关联合同为必填项");
return contractExist;
}
//补充协议开始日期不能晚于原始合同的结束日期
Contract relationContract = contractRepository.findOne(contract.getRelationContract());
if(relationContract.getEndDate().compareTo(contract.getStartDate())<0){
Contract contractExist = new Contract();
contractExist.setId(-100L);
contractExist.setErroMessage("补充协议开始日期不能晚于原始合同的结束日期");
return contractExist;
}
}
if (resource.getContractCode() != null && !resource.getContractCode().equals(contract.getContractCode())) {
Contract contractExist = contractRepository.findByCode(resource.getContractCode().trim());
if (contractExist != null) {
......@@ -1487,15 +1506,17 @@ public class ContractServiceImpl implements ContractService {
}
//对结果二次加工
List<Long> relationContracts = contractRepository.findRelationContractBySideAgre();//查询被补充协议关联的合同
for(Contract contract:result){
if(null ==contract.getContractType() || !"2".equals(contract.getContractType())){ //非补充协议
if(relationContracts.contains(BigInteger.valueOf(contract.getId()))){
contract.setOperate(false);//如果合同 被补充协议关联
}
}else {
if(contract.getRelationContract()!=null && contract.getRelationContract()>0){ //补充协议
contract.setOperate(false);//如果补充协议被关联
if("tkio".equals(platform)){
List<Long> relationContracts = contractRepository.findRelationContractBySideAgre();//查询被补充协议关联的合同
for(Contract contract:result){
if(null ==contract.getContractType() || !"2".equals(contract.getContractType())){ //非补充协议
if(relationContracts.contains(BigInteger.valueOf(contract.getId()))){
contract.setOperate(false);//如果合同 被补充协议关联
}
}else {
if(contract.getRelationContract()!=null && contract.getRelationContract()>0){ //补充协议
contract.setOperate(false);//如果补充协议被关联
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment