存储subjectcode
This commit is contained in:
+1
-1
@@ -331,7 +331,7 @@ public class ContractLaunchController {
|
|||||||
*/
|
*/
|
||||||
@GetMapping("/{id}/counterparty-confirm")
|
@GetMapping("/{id}/counterparty-confirm")
|
||||||
public R<Map<String, Object>> getCounterpartyConfirm(@PathVariable("id") Long id) {
|
public R<Map<String, Object>> getCounterpartyConfirm(@PathVariable("id") Long id) {
|
||||||
return R.success(contractLaunchService.getCounterpartyConfirmMap(id));
|
return R.success(contractLaunchService.getCounterpartyConfirmFiltered(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -59,6 +59,9 @@ public interface ContractLaunchService {
|
|||||||
/** 获取相对方签署确认状态 Map */
|
/** 获取相对方签署确认状态 Map */
|
||||||
Map<String, Object> getCounterpartyConfirmMap(Long id);
|
Map<String, Object> getCounterpartyConfirmMap(Long id);
|
||||||
|
|
||||||
|
/** 获取相对方签署确认状态(按权限过滤:manage 全量,business 只看自己) */
|
||||||
|
Map<String, Object> getCounterpartyConfirmFiltered(Long id);
|
||||||
|
|
||||||
/** 相对方确认已签署完成 */
|
/** 相对方确认已签署完成 */
|
||||||
Map<String, Object> confirmCounterparty(Long id, String companyName);
|
Map<String, Object> confirmCounterparty(Long id, String companyName);
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ import com.nbport.zgwl.contractlaunch.utils.JsonUtils;
|
|||||||
import com.nbport.zgwl.contractpush.dto.PushPayloadDTO;
|
import com.nbport.zgwl.contractpush.dto.PushPayloadDTO;
|
||||||
import com.nbport.zgwl.contractpush.service.DataCollectionPushService;
|
import com.nbport.zgwl.contractpush.service.DataCollectionPushService;
|
||||||
import com.nbport.zgwl.contractpush.service.SettlementPushService;
|
import com.nbport.zgwl.contractpush.service.SettlementPushService;
|
||||||
|
import com.nbport.zgwl.partner.dto.PartnerManageDto;
|
||||||
|
import com.nbport.zgwl.partner.service.PartnerManageService;
|
||||||
import com.nbport.zgwl.seal.service.SealTokenService;
|
import com.nbport.zgwl.seal.service.SealTokenService;
|
||||||
import com.nbport.zgwl.seal.config.SealConfig;
|
import com.nbport.zgwl.seal.config.SealConfig;
|
||||||
import com.nbport.zgwl.seal.utils.SealHttpClient;
|
import com.nbport.zgwl.seal.utils.SealHttpClient;
|
||||||
@@ -81,6 +83,7 @@ public class ContractLaunchServiceImpl implements ContractLaunchService {
|
|||||||
private final LocalFileService localFileService;
|
private final LocalFileService localFileService;
|
||||||
private final SealTokenService sealTokenService;
|
private final SealTokenService sealTokenService;
|
||||||
private final SealConfig sealConfig;
|
private final SealConfig sealConfig;
|
||||||
|
private final PartnerManageService partnerManageService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询,附带合同方/文件/履行计划(列表页不查日志)。
|
* 分页查询,附带合同方/文件/履行计划(列表页不查日志)。
|
||||||
@@ -607,6 +610,33 @@ public class ContractLaunchServiceImpl implements ContractLaunchService {
|
|||||||
return JsonUtils.parseMap(raw);
|
return JsonUtils.parseMap(raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> getCounterpartyConfirmFiltered(Long id) {
|
||||||
|
Map<String, Object> all = getCounterpartyConfirmMap(id);
|
||||||
|
SysUserEntity currentUser = adminSecurityManage.getUser();
|
||||||
|
boolean canManageAll = authManager.isUserCanAccessSys(currentUser.getId(), SysEnum.MANAGE);
|
||||||
|
if (canManageAll) {
|
||||||
|
return all;
|
||||||
|
}
|
||||||
|
// business 用户只返回自己组织对应的相对方确认状态
|
||||||
|
ContractLaunchDto contract = getDetail(id);
|
||||||
|
String userOrgId = currentUser.getSysOrgEntity() == null ? "" : String.valueOf(currentUser.getSysOrgEntity().getId());
|
||||||
|
String userOrgName = currentUser.getSysOrgEntity() == null ? "" : currentUser.getSysOrgEntity().getOrgName();
|
||||||
|
Map<String, Object> filtered = new LinkedHashMap<>();
|
||||||
|
if (contract.getPartyList() != null) {
|
||||||
|
contract.getPartyList().stream()
|
||||||
|
.filter(this::isOppositeParty)
|
||||||
|
.filter(p -> userOrgId.equals(p.getOppositeId())
|
||||||
|
|| userOrgId.equals(p.getSubjectCode())
|
||||||
|
|| userOrgName.equals(p.getCompanyName()))
|
||||||
|
.forEach(p -> {
|
||||||
|
String name = p.getCompanyName();
|
||||||
|
filtered.put(name, all.getOrDefault(name, new LinkedHashMap<>()));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return filtered;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Map<String, Object> confirmCounterparty(Long id, String companyName) {
|
public Map<String, Object> confirmCounterparty(Long id, String companyName) {
|
||||||
@@ -616,6 +646,19 @@ public class ContractLaunchServiceImpl implements ContractLaunchService {
|
|||||||
String username = currentUser.getUsername();
|
String username = currentUser.getUsername();
|
||||||
String mobile = currentUser.getMobilePhone();
|
String mobile = currentUser.getMobilePhone();
|
||||||
|
|
||||||
|
// 权限校验:business 用户只能确认自己组织对应的相对方
|
||||||
|
boolean canManageAll = authManager.isUserCanAccessSys(currentUser.getId(), SysEnum.MANAGE);
|
||||||
|
if (!canManageAll) {
|
||||||
|
String userOrgId = currentUser.getSysOrgEntity() == null ? "" : String.valueOf(currentUser.getSysOrgEntity().getId());
|
||||||
|
boolean matched = (contract.getPartyList() != null) && contract.getPartyList().stream()
|
||||||
|
.filter(this::isOppositeParty)
|
||||||
|
.anyMatch(p -> companyName.equals(p.getCompanyName())
|
||||||
|
&& (userOrgId.equals(p.getOppositeId()) || userOrgId.equals(p.getSubjectCode())));
|
||||||
|
if (!matched) {
|
||||||
|
throw new ServiceException("只能确认本组织对应的相对方");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Map<String, Object> confirmMap = getCounterpartyConfirmMap(id);
|
Map<String, Object> confirmMap = getCounterpartyConfirmMap(id);
|
||||||
|
|
||||||
Map<String, Object> entry = new LinkedHashMap<>();
|
Map<String, Object> entry = new LinkedHashMap<>();
|
||||||
@@ -1074,6 +1117,18 @@ public class ContractLaunchServiceImpl implements ContractLaunchService {
|
|||||||
party.setId(contractLaunchMapper.selectPartySeqNextVal());
|
party.setId(contractLaunchMapper.selectPartySeqNextVal());
|
||||||
party.setContractId(contract.getId());
|
party.setContractId(contract.getId());
|
||||||
party.setSortOrder(i + 1);
|
party.setSortOrder(i + 1);
|
||||||
|
// 相对方补充 subjectCode = linkedOrgId,用于确认签署时按组织匹配
|
||||||
|
if (isOppositeParty(party) && party.getPartnerId() != null
|
||||||
|
&& (party.getSubjectCode() == null || party.getSubjectCode().isBlank())) {
|
||||||
|
try {
|
||||||
|
PartnerManageDto partner = partnerManageService.selectPartnerById(party.getPartnerId());
|
||||||
|
if (partner != null && partner.getLinkedOrgId() != null) {
|
||||||
|
party.setSubjectCode(String.valueOf(partner.getLinkedOrgId()));
|
||||||
|
}
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
// 相对方查询失败不阻塞保存
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!contract.getPartyList().isEmpty()) {
|
if (!contract.getPartyList().isEmpty()) {
|
||||||
contractLaunchMapper.batchInsertParty(contract.getPartyList(), operator, operator);
|
contractLaunchMapper.batchInsertParty(contract.getPartyList(), operator, operator);
|
||||||
|
|||||||
Reference in New Issue
Block a user