单方协议
This commit is contained in:
+50
-7
@@ -344,6 +344,9 @@ public class ContractLaunchServiceImpl implements ContractLaunchService {
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public ContractLaunchDto handleLawApproveCallback(ContractLaunchLawCallbackDto callbackData) {
|
public ContractLaunchDto handleLawApproveCallback(ContractLaunchLawCallbackDto callbackData) {
|
||||||
ContractLaunchDto contract = getContractByLawCallback(callbackData);
|
ContractLaunchDto contract = getContractByLawCallback(callbackData);
|
||||||
|
if (isSingleAgreement(contract)) {
|
||||||
|
throw new ServiceException("单方协议不接收法务审批回调");
|
||||||
|
}
|
||||||
SysUserEntity currentUser = adminSecurityManage.getUser();
|
SysUserEntity currentUser = adminSecurityManage.getUser();
|
||||||
|
|
||||||
boolean approved = isLawCallbackApproved(callbackData);
|
boolean approved = isLawCallbackApproved(callbackData);
|
||||||
@@ -394,6 +397,9 @@ public class ContractLaunchServiceImpl implements ContractLaunchService {
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public ContractLaunchDto saveSealInfo(Long id, ContractLaunchSealDto sealDto) {
|
public ContractLaunchDto saveSealInfo(Long id, ContractLaunchSealDto sealDto) {
|
||||||
ContractLaunchDto contract = getDetail(id);
|
ContractLaunchDto contract = getDetail(id);
|
||||||
|
if (isSingleAgreement(contract)) {
|
||||||
|
throw new ServiceException("单方协议无需发起在线签章");
|
||||||
|
}
|
||||||
SysUserEntity currentUser = adminSecurityManage.getUser();
|
SysUserEntity currentUser = adminSecurityManage.getUser();
|
||||||
contract.setSealContractId(sealDto.getSealContractId());
|
contract.setSealContractId(sealDto.getSealContractId());
|
||||||
contract.setSealContractStatus(sealDto.getSealContractStatus());
|
contract.setSealContractStatus(sealDto.getSealContractStatus());
|
||||||
@@ -425,6 +431,7 @@ public class ContractLaunchServiceImpl implements ContractLaunchService {
|
|||||||
ContractLaunchDto contract = getDetail(id);
|
ContractLaunchDto contract = getDetail(id);
|
||||||
SysUserEntity currentUser = adminSecurityManage.getUser();
|
SysUserEntity currentUser = adminSecurityManage.getUser();
|
||||||
LocalDateTime completedTime = LocalDateTime.now();
|
LocalDateTime completedTime = LocalDateTime.now();
|
||||||
|
boolean singleAgreement = isSingleAgreement(contract);
|
||||||
contract.setSealContractId(sealDto.getSealContractId() == null || sealDto.getSealContractId().isBlank() ? contract.getSealContractId() : sealDto.getSealContractId());
|
contract.setSealContractId(sealDto.getSealContractId() == null || sealDto.getSealContractId().isBlank() ? contract.getSealContractId() : sealDto.getSealContractId());
|
||||||
contract.setSealContractStatus(sealDto.getSealContractStatus());
|
contract.setSealContractStatus(sealDto.getSealContractStatus());
|
||||||
contract.setSignedFileName(sealDto.getSignedFileName());
|
contract.setSignedFileName(sealDto.getSignedFileName());
|
||||||
@@ -439,12 +446,20 @@ public class ContractLaunchServiceImpl implements ContractLaunchService {
|
|||||||
contract.setSealDate(firstNonNull(sealDto.getSealDate(), contract.getSealDate(), contract.getSignDate()));
|
contract.setSealDate(firstNonNull(sealDto.getSealDate(), contract.getSealDate(), contract.getSignDate()));
|
||||||
contract.setActiveDate(firstNonNull(sealDto.getActiveDate(), contract.getActiveDate()));
|
contract.setActiveDate(firstNonNull(sealDto.getActiveDate(), contract.getActiveDate()));
|
||||||
validateSignCompletion(contract);
|
validateSignCompletion(contract);
|
||||||
contract.setStatus(ContractLaunchConstants.STATUS_PENDING_COLLECT);
|
contract.setStatus(singleAgreement ? ContractLaunchConstants.STATUS_COMPLETED : ContractLaunchConstants.STATUS_PENDING_COLLECT);
|
||||||
contract.setUpdateBy(currentUser.getUsername());
|
contract.setUpdateBy(currentUser.getUsername());
|
||||||
contract.setUpdateTime(completedTime);
|
contract.setUpdateTime(completedTime);
|
||||||
contractLaunchMapper.updateContract(contract);
|
contractLaunchMapper.updateContract(contract);
|
||||||
saveSignedFile(id, sealDto, currentUser.getUsername());
|
saveSignedFile(id, sealDto, currentUser.getUsername());
|
||||||
insertLog(id, ContractLaunchConstants.ACTION_SEAL_FINISH, "签署完成", ContractLaunchConstants.ACTION_STATUS_SUCCESS, "合同签署已完成,待采集", sealDto, currentUser);
|
insertLog(
|
||||||
|
id,
|
||||||
|
ContractLaunchConstants.ACTION_SEAL_FINISH,
|
||||||
|
singleAgreement ? "盖章完成" : "签署完成",
|
||||||
|
ContractLaunchConstants.ACTION_STATUS_SUCCESS,
|
||||||
|
singleAgreement ? "单方协议已盖章生效,流程完成" : "合同签署已完成,待采集",
|
||||||
|
sealDto,
|
||||||
|
currentUser
|
||||||
|
);
|
||||||
return getDetail(id);
|
return getDetail(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -471,6 +486,9 @@ public class ContractLaunchServiceImpl implements ContractLaunchService {
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public ContractLaunchDto mockCollect(Long id) {
|
public ContractLaunchDto mockCollect(Long id) {
|
||||||
ContractLaunchDto contract = getDetail(id);
|
ContractLaunchDto contract = getDetail(id);
|
||||||
|
if (isSingleAgreement(contract)) {
|
||||||
|
throw new ServiceException("单方协议无需执行法务采集");
|
||||||
|
}
|
||||||
if (!ContractLaunchConstants.STATUS_PENDING_COLLECT.equals(contract.getStatus())) {
|
if (!ContractLaunchConstants.STATUS_PENDING_COLLECT.equals(contract.getStatus())) {
|
||||||
throw new ServiceException("当前状态不允许执行采集");
|
throw new ServiceException("当前状态不允许执行采集");
|
||||||
}
|
}
|
||||||
@@ -513,6 +531,9 @@ public class ContractLaunchServiceImpl implements ContractLaunchService {
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public ContractLaunchDto archive(Long id, ContractLaunchArchiveDto archiveDto) {
|
public ContractLaunchDto archive(Long id, ContractLaunchArchiveDto archiveDto) {
|
||||||
ContractLaunchDto contract = getDetail(id);
|
ContractLaunchDto contract = getDetail(id);
|
||||||
|
if (isSingleAgreement(contract)) {
|
||||||
|
throw new ServiceException("单方协议无需执行法务归档");
|
||||||
|
}
|
||||||
if (!ContractLaunchConstants.STATUS_PENDING_ARCHIVE.equals(contract.getStatus())) {
|
if (!ContractLaunchConstants.STATUS_PENDING_ARCHIVE.equals(contract.getStatus())) {
|
||||||
throw new ServiceException("当前状态不允许归档");
|
throw new ServiceException("当前状态不允许归档");
|
||||||
}
|
}
|
||||||
@@ -839,11 +860,13 @@ public class ContractLaunchServiceImpl implements ContractLaunchService {
|
|||||||
item.setArchiveEles(archiveEles);
|
item.setArchiveEles(archiveEles);
|
||||||
item.setLogList(new ArrayList<>(logMap.getOrDefault(item.getId(), Collections.emptyList())));
|
item.setLogList(new ArrayList<>(logMap.getOrDefault(item.getId(), Collections.emptyList())));
|
||||||
item.setCounterpartySummary(
|
item.setCounterpartySummary(
|
||||||
item.getPartyList().stream()
|
isSingleAgreement(item)
|
||||||
.filter(this::isOppositeParty)
|
? "单方协议"
|
||||||
.map(ContractLaunchPartyDto::getCompanyName)
|
: item.getPartyList().stream()
|
||||||
.filter(name -> name != null && !name.isBlank())
|
.filter(this::isOppositeParty)
|
||||||
.collect(Collectors.joining(";"))
|
.map(ContractLaunchPartyDto::getCompanyName)
|
||||||
|
.filter(name -> name != null && !name.isBlank())
|
||||||
|
.collect(Collectors.joining(";"))
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -962,6 +985,7 @@ public class ContractLaunchServiceImpl implements ContractLaunchService {
|
|||||||
if (contract == null) {
|
if (contract == null) {
|
||||||
throw new ServiceException("合同数据不能为空");
|
throw new ServiceException("合同数据不能为空");
|
||||||
}
|
}
|
||||||
|
boolean singleAgreement = isSingleAgreement(contract);
|
||||||
contract.setContractName(trim(contract.getContractName()));
|
contract.setContractName(trim(contract.getContractName()));
|
||||||
contract.setContractCode(trim(contract.getContractCode()));
|
contract.setContractCode(trim(contract.getContractCode()));
|
||||||
contract.setContractType(trim(contract.getContractType()));
|
contract.setContractType(trim(contract.getContractType()));
|
||||||
@@ -999,6 +1023,12 @@ public class ContractLaunchServiceImpl implements ContractLaunchService {
|
|||||||
if (contract.getPushUrl() == null || contract.getPushUrl().isBlank()) {
|
if (contract.getPushUrl() == null || contract.getPushUrl().isBlank()) {
|
||||||
contract.setPushUrl("/contract/launch/callback/law/approve");
|
contract.setPushUrl("/contract/launch/callback/law/approve");
|
||||||
}
|
}
|
||||||
|
if (singleAgreement) {
|
||||||
|
contract.setIsElectron("0");
|
||||||
|
if (contract.getSealType() == null || contract.getSealType().isBlank()) {
|
||||||
|
contract.setSealType("YWZ");
|
||||||
|
}
|
||||||
|
}
|
||||||
if (contract.getSealQuantity() == null) {
|
if (contract.getSealQuantity() == null) {
|
||||||
contract.setSealQuantity(1);
|
contract.setSealQuantity(1);
|
||||||
}
|
}
|
||||||
@@ -1019,9 +1049,11 @@ public class ContractLaunchServiceImpl implements ContractLaunchService {
|
|||||||
if (contract == null || contract.getPartyList() == null) {
|
if (contract == null || contract.getPartyList() == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
boolean singleAgreement = isSingleAgreement(contract);
|
||||||
List<ContractLaunchPartyDto> normalized = contract.getPartyList().stream()
|
List<ContractLaunchPartyDto> normalized = contract.getPartyList().stream()
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
.filter(item -> item.getCompanyName() != null && !item.getCompanyName().isBlank())
|
.filter(item -> item.getCompanyName() != null && !item.getCompanyName().isBlank())
|
||||||
|
.filter(item -> !singleAgreement || !isOppositeParty(item))
|
||||||
.peek(item -> {
|
.peek(item -> {
|
||||||
String roleCode = trim(item.getRoleCode());
|
String roleCode = trim(item.getRoleCode());
|
||||||
if (roleCode == null || roleCode.isBlank()) {
|
if (roleCode == null || roleCode.isBlank()) {
|
||||||
@@ -1146,6 +1178,17 @@ public class ContractLaunchServiceImpl implements ContractLaunchService {
|
|||||||
if (!containsCurrentOrg) {
|
if (!containsCurrentOrg) {
|
||||||
throw new ServiceException("我方主体中必须包含当前登录主体");
|
throw new ServiceException("我方主体中必须包含当前登录主体");
|
||||||
}
|
}
|
||||||
|
if (isSingleAgreement(contract)) {
|
||||||
|
boolean onlyCurrentOrg = contract.getPartyList().stream()
|
||||||
|
.filter(this::isOurParty)
|
||||||
|
.map(ContractLaunchPartyDto::getSubjectCode)
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.map(String::trim)
|
||||||
|
.allMatch(currentOrgId::equals);
|
||||||
|
if (!onlyCurrentOrg) {
|
||||||
|
throw new ServiceException("单方协议仅允许使用当前登录主体");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!isSingleAgreement(contract) && !hasCounterparty) {
|
if (!isSingleAgreement(contract) && !hasCounterparty) {
|
||||||
throw new ServiceException("至少维护一个相对方");
|
throw new ServiceException("至少维护一个相对方");
|
||||||
|
|||||||
Reference in New Issue
Block a user