调试mk
This commit is contained in:
+1
@@ -170,6 +170,7 @@ public class BusinessProcessServiceImpl extends ServiceImpl<BusinessProcessMappe
|
||||
this.saveOrUpdate(businessProcess);
|
||||
List<?> currentNodes = this.getCurrentNodes(processInstanceId, loginName);
|
||||
this.syncCustomerArchiveCurrentNode(param.getFormInstanceId(), currentNodes);
|
||||
this.getProcessInfo(processInstanceId, loginName);
|
||||
return processInstanceId;
|
||||
}
|
||||
|
||||
|
||||
+36
-2
@@ -109,12 +109,12 @@ public class CustomerArchivePublicController {
|
||||
log.warn("客商公开页流程消息未找到 processId,跳过查询当前节点");
|
||||
return R.success("ok");
|
||||
}
|
||||
String customerIdText = firstText(asMap(body == null ? null : body.get("formData")), "id");
|
||||
try {
|
||||
FR<Object> result = businessProcessClient.getCurrentNodes(processId, loginName);
|
||||
Object nodeData = result == null ? null : result.getData();
|
||||
log.info("客商公开页流程消息当前节点详情 processId={} loginName={} result={}",
|
||||
processId, loginName, JSON.toJSONString(nodeData));
|
||||
String customerIdText = firstText(asMap(body == null ? null : body.get("formData")), "id");
|
||||
if (StringUtil.isBlank(customerIdText)) {
|
||||
log.warn("客商公开页流程消息未找到客商id,跳过同步当前节点");
|
||||
} else {
|
||||
@@ -129,14 +129,48 @@ public class CustomerArchivePublicController {
|
||||
}
|
||||
try {
|
||||
FR<Object> processInfoResult = businessProcessClient.getProcessInfo(processId, loginName);
|
||||
Object processInfo = processInfoResult == null ? null : processInfoResult.getData();
|
||||
log.info("客商公开页流程消息流程实例详情 processId={} loginName={} result={}",
|
||||
processId, loginName, JSON.toJSONString(processInfoResult == null ? null : processInfoResult.getData()));
|
||||
processId, loginName, JSON.toJSONString(processInfo));
|
||||
if (isProcessFinished(processInfo)) {
|
||||
applyProcessResult(customerIdText, processId, formValues, true);
|
||||
} else if (isProcessRejected(processInfo)) {
|
||||
applyProcessResult(customerIdText, processId, formValues, false);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("客商公开页查询流程实例详情失败 processId={} loginName={}", processId, loginName, e);
|
||||
}
|
||||
return R.success("ok");
|
||||
}
|
||||
|
||||
private static boolean isProcessFinished(Object processInfo) {
|
||||
return "30".equals(firstText(asMap(processInfo), "fdProcessStatus"));
|
||||
}
|
||||
|
||||
private static boolean isProcessRejected(Object processInfo) {
|
||||
return "20".equals(firstText(asMap(processInfo), "fdProcessStatus"));
|
||||
}
|
||||
|
||||
private void applyProcessResult(String customerIdText, String processId, Map<String, Object> formValues,
|
||||
boolean approved) {
|
||||
String action = approved ? "审核通过" : "审核驳回";
|
||||
if (StringUtil.isBlank(customerIdText)) {
|
||||
log.warn("流程{}但未找到客商id,跳过同步 processId={}", action, processId);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
String processorName = firstText(formValues, "mkUserName", "mkLoginName");
|
||||
Long customerId = Long.valueOf(customerIdText);
|
||||
if (approved) {
|
||||
customerArchiveService.approveFromProcess(customerId, processorName);
|
||||
} else {
|
||||
customerArchiveService.rejectFromProcess(customerId, processorName);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
log.warn("流程{}但客商id格式不正确:{}", action, customerIdText);
|
||||
}
|
||||
}
|
||||
|
||||
private static Map<String, Object> asMap(Object value) {
|
||||
if (!(value instanceof Map<?, ?> map)) {
|
||||
return Collections.emptyMap();
|
||||
|
||||
+18
@@ -120,6 +120,24 @@ public interface ICustomerArchiveService extends BaseService<CustomerArchive> {
|
||||
*/
|
||||
boolean syncProcessNodeFromMk(Long id, Object currentNodes);
|
||||
|
||||
/**
|
||||
* MK 流程结束(fdProcessStatus=30)时将客商置为审核通过
|
||||
*
|
||||
* @param id 客商ID
|
||||
* @param processorName 当前处理人,可为空
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean approveFromProcess(Long id, String processorName);
|
||||
|
||||
/**
|
||||
* MK 流程状态为 20 时将客商置为审核驳回
|
||||
*
|
||||
* @param id 客商ID
|
||||
* @param processorName 当前处理人,可为空
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean rejectFromProcess(Long id, String processorName);
|
||||
|
||||
/**
|
||||
* 撤回审批并恢复草稿状态
|
||||
*
|
||||
|
||||
+56
@@ -284,6 +284,62 @@ public class CustomerArchiveServiceImpl extends BaseServiceImpl<CustomerArchiveM
|
||||
return syncProcessNode(id, joinDistinct(nodeNames), joinDistinct(handlerNames), APPROVAL_REVIEWING);
|
||||
}
|
||||
|
||||
@Override
|
||||
@TenantIgnore
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean approveFromProcess(Long id, String processorName) {
|
||||
if (Func.isEmpty(id)) {
|
||||
log.warn("流程结束审核通过失败,客商ID为空");
|
||||
return false;
|
||||
}
|
||||
CustomerArchive before = getById(id);
|
||||
if (before == null || Objects.equals(before.getIsDeleted(), 1)) {
|
||||
log.warn("流程结束审核通过失败,客商不存在 id={}", id);
|
||||
return false;
|
||||
}
|
||||
if (Objects.equals(before.getApprovalStatus(), APPROVAL_APPROVED)) {
|
||||
log.info("流程结束审核通过跳过,客商已是审核通过 id={}", id);
|
||||
return true;
|
||||
}
|
||||
CustomerArchive after = copyCustomer(before);
|
||||
after.setAccessType(ACCESS_FORMAL);
|
||||
after.setApprovalStatus(APPROVAL_APPROVED);
|
||||
after.setCurrentNode("审核通过");
|
||||
after.setCurrentProcessor(Func.isEmpty(processorName) ? "系统" : processorName.trim());
|
||||
after.setApprovedTime(LocalDateTime.now());
|
||||
addChangeRecord(id, "客商准入审核通过", before, after);
|
||||
boolean updated = updateById(after);
|
||||
log.info("流程结束审核通过 id={} processor={} result={}", id, after.getCurrentProcessor(), updated);
|
||||
return updated;
|
||||
}
|
||||
|
||||
@Override
|
||||
@TenantIgnore
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean rejectFromProcess(Long id, String processorName) {
|
||||
if (Func.isEmpty(id)) {
|
||||
log.warn("流程审核驳回失败,客商ID为空");
|
||||
return false;
|
||||
}
|
||||
CustomerArchive before = getById(id);
|
||||
if (before == null || Objects.equals(before.getIsDeleted(), 1)) {
|
||||
log.warn("流程审核驳回失败,客商不存在 id={}", id);
|
||||
return false;
|
||||
}
|
||||
if (Objects.equals(before.getApprovalStatus(), APPROVAL_REJECTED)) {
|
||||
log.info("流程审核驳回跳过,客商已是审核不通过 id={}", id);
|
||||
return true;
|
||||
}
|
||||
CustomerArchive after = copyCustomer(before);
|
||||
after.setApprovalStatus(APPROVAL_REJECTED);
|
||||
after.setCurrentNode("审核不通过");
|
||||
after.setCurrentProcessor(Func.isEmpty(processorName) ? "系统" : processorName.trim());
|
||||
addChangeRecord(id, "客商准入审核不通过", before, after);
|
||||
boolean updated = updateById(after);
|
||||
log.info("流程审核驳回 id={} processor={} result={}", id, after.getCurrentProcessor(), updated);
|
||||
return updated;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean withdrawApproval(Long id) {
|
||||
|
||||
Reference in New Issue
Block a user