简述
物业、租赁合同在流程变更的时候会发送MQ消息,物业服务监听了流程变更的主题,当流程结束的时候会推送一条消息到物业的消息(MQ),计费服务监听了物业的这个消息主题处理之后的逻辑
详细的介绍
监听及消息体
监听:监听paiWorkFlow(流程消息主题)
@PaiMqListener(suiteCode = "zhsp", topic = "paiWorkFlow")
logger:打印的是流程中心推送的流程消息(有待办id、业务id 等等)
LogUtil.info("consumer vo: {}", vo);
1、pai-park-property(物业服务)
逻辑处理:
@Component
public class FlowConsumer {
@PaiMqListener(suiteCode = "zhsp", topic = "paiWorkFlow")
public void consumer(String msg) {
StaticLog.info("Consumer " + logEnv + " Listener (:" + DateUtil.now() + "): msg:" + msg);
LogUtil.info("FlowConsumer msg: {}, env: {}", msg, logEnv);
// 转换消息bean
PaiMqMessageBean<String> bean = JSON.parseObject(msg,
new TypeReference<PaiMqMessageBean<String>>() {
});
FlowChangeEntity vo = JSON.parseObject(bean.getData(), FlowChangeEntity.class);
LogUtil.info("consumer vo: {}", vo);
String businessKey = vo.getBusinessKey();
if (FlowConstants.LEASE_CONTRACT_ADD.equals(vo.getBizKey())
|| FlowConstants.LEASE_CONTRACT_RENEWAL.equals(vo.getBizKey())
|| FlowConstants.LEASE_CONTRACT_CHANGE.equals(vo.getBizKey())
|| FlowConstants.LEASE_CONTRACT_RESERVE.equals(vo.getBizKey())
|| FlowConstants.LEASE_CONTRACT_SUBLEASE.equals(vo.getBizKey())) {
handleLease(vo);
}
if (FlowConstants.LEASE_CONTRACT_TERMINATION.equals(vo.getBizKey())) {
handleLeaseTerminate(vo, businessKey);
}
if (FlowConstants.PROPERTY_CONTRACT_ADD.equals(vo.getBizKey())
|| FlowConstants.PROPERTY_CONTRACT_CHANGE.equals(vo.getBizKey())) {
handleProperty(vo, businessKey);
}
if (FlowConstants.SALE_CONTRACT.equals(vo.getBizKey())) {
handleSale(vo, businessKey);
}
}
private void handleSale(FlowChangeEntity vo, String businessKey) {
// 业务处理
}
private void handleProperty(FlowChangeEntity vo, String businessKey) {
// 业务处理
}
private void handleLeaseTerminate(FlowChangeEntity vo, String businessKey) {
// 业务处理
}
private void handleLease(FlowChangeEntity vo) {
// 业务处理
}
}
2、pai-finance 计费服务
简述:当合同流程正常结束后:消费物业服务推送的物业消息
逻辑处理:
@Component
public class PropertyConsumer {
/**
* 消费物业消息
*
* @param msg 消息
*/
@PaiMqListener(suiteCode = PROPERTY, topic = "${pai.mq.property}")
public void consume(String msg) {
// 转换消息bean
StaticLog.info("property: {}", msg);
PaiMqMessageBean<String> bean = JSON.parseObject(msg,
new TypeReference<PaiMqMessageBean<String>>() {
});
String status = bean.getStatus();
// 处理合同
if (PROPERTY_LEASE_CONTRACT.equals(bean.getTag())) {
LeaseContractVO contract = JSON.parseObject(bean.getData(), LeaseContractVO.class);
handle(contract, status, ContractTypeEnum.LEASE.getValue());
} else if (PROPERTY_PROPERTY_CONTRACT.equals(bean.getTag())) {
PropertyContractVO contract = JSON.parseObject(bean.getData(), PropertyContractVO.class);
handle(contract, status, ContractTypeEnum.PROPERTY.getValue());
}
}
/**
* 处理合同押金、首期款、购方信息
*
* @param contract 合同对象
* @param status 操作类型
*/
public void handle(Contract contract, String status, int contractType) {
// 业务处理
}
}
文档更新时间: 2023-07-12 13:56 作者:姚连洲