From 2f73a671db8bf132baaba12a5c2a9c3b611589e9 Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期四, 01 八月 2019 17:14:26 +0800
Subject: [PATCH] 修复 添加房屋时的侦听 类修改
---
CommunityService/src/main/java/com/java110/community/smo/impl/CommunityServiceSMOImpl.java | 89 +++++++++++++++++++++++---------------------
1 files changed, 47 insertions(+), 42 deletions(-)
diff --git a/CommunityService/src/main/java/com/java110/community/smo/impl/CommunityServiceSMOImpl.java b/CommunityService/src/main/java/com/java110/community/smo/impl/CommunityServiceSMOImpl.java
index b68ca48..89b21ec 100644
--- a/CommunityService/src/main/java/com/java110/community/smo/impl/CommunityServiceSMOImpl.java
+++ b/CommunityService/src/main/java/com/java110/community/smo/impl/CommunityServiceSMOImpl.java
@@ -17,6 +17,8 @@
import com.java110.entity.center.DataFlowLog;
import com.java110.event.service.BusinessServiceDataFlowEventPublishing;
import com.java110.community.smo.ICommunityServiceSMO;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -31,77 +33,80 @@
@Transactional
public class CommunityServiceSMOImpl extends BaseServiceSMO implements ICommunityServiceSMO {
+ private static Logger logger = LoggerFactory.getLogger(CommunityServiceSMOImpl.class);
- @Override
- public JSONObject service(BusinessServiceDataFlow businessServiceDataFlow) throws SMOException {
- try {
- Assert.hasLength(businessServiceDataFlow.getbId(),"bId 涓嶈兘涓虹┖");
+ @Override
+ public JSONObject service(BusinessServiceDataFlow businessServiceDataFlow) throws SMOException {
+ try {
+ Assert.hasLength(businessServiceDataFlow.getbId(), "bId 涓嶈兘涓虹┖");
- BusinessServiceDataFlowEventPublishing.multicastEvent(businessServiceDataFlow);
- Assert.notEmpty(businessServiceDataFlow.getResJson(),"鐢ㄦ埛鏈嶅姟["+businessServiceDataFlow.getCurrentBusiness().getServiceCode()+"]娌℃湁杩斿洖鍐呭");
- } catch (Exception e) {
- logger.error("鐢ㄦ埛淇℃伅澶勭悊寮傚父",e);
- throw new SMOException(ResponseConstant.RESULT_PARAM_ERROR,"鐢ㄦ埛淇℃伅澶勭悊寮傚父"+e.getMessage());
- }finally {
- if(businessServiceDataFlow == null){
- return null;
- }
-
- //杩欓噷璁板綍鏃ュ織
- Date endDate = DateUtil.getCurrentDate();
-
- businessServiceDataFlow.setEndDate(endDate);
- //娣诲姞鑰楁椂
- DataFlowFactory.addCostTime(businessServiceDataFlow, "service", "涓氬姟澶勭悊鎬昏�楁椂",
- businessServiceDataFlow.getStartDate(), businessServiceDataFlow.getEndDate());
- //淇濆瓨鑰楁椂
- saveCostTimeLogMessage(businessServiceDataFlow);
- //淇濆瓨鏃ュ織
- saveLogMessage(businessServiceDataFlow);
+ BusinessServiceDataFlowEventPublishing.multicastEvent(businessServiceDataFlow);
+ Assert.notEmpty(businessServiceDataFlow.getResJson(), "鐢ㄦ埛鏈嶅姟[" + businessServiceDataFlow.getCurrentBusiness().getServiceCode() + "]娌℃湁杩斿洖鍐呭");
+ } catch (Exception e) {
+ logger.error("鐢ㄦ埛淇℃伅澶勭悊寮傚父", e);
+ throw new SMOException(ResponseConstant.RESULT_PARAM_ERROR, "鐢ㄦ埛淇℃伅澶勭悊寮傚父" + e.getMessage());
+ } finally {
+ if (businessServiceDataFlow == null) {
+ return null;
}
- return businessServiceDataFlow.getResJson();
+
+ //杩欓噷璁板綍鏃ュ織
+ Date endDate = DateUtil.getCurrentDate();
+
+ businessServiceDataFlow.setEndDate(endDate);
+ //娣诲姞鑰楁椂
+ DataFlowFactory.addCostTime(businessServiceDataFlow, "service", "涓氬姟澶勭悊鎬昏�楁椂",
+ businessServiceDataFlow.getStartDate(), businessServiceDataFlow.getEndDate());
+ //淇濆瓨鑰楁椂
+ saveCostTimeLogMessage(businessServiceDataFlow);
+ //淇濆瓨鏃ュ織
+ saveLogMessage(businessServiceDataFlow);
+ }
+ return businessServiceDataFlow.getResJson();
}
/**
* 淇濆瓨鏃ュ織淇℃伅
+ *
* @param businessServiceDataFlow
*/
- private void saveLogMessage(BusinessServiceDataFlow businessServiceDataFlow){
+ private void saveLogMessage(BusinessServiceDataFlow businessServiceDataFlow) {
- try{
- if(MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_LOG_ON_OFF))){
- for(DataFlowLog dataFlowLog :businessServiceDataFlow.getLogDatas()) {
+ try {
+ if (MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_LOG_ON_OFF))) {
+ for (DataFlowLog dataFlowLog : businessServiceDataFlow.getLogDatas()) {
KafkaFactory.sendKafkaMessage(KafkaConstant.TOPIC_LOG_NAME, "", JSONObject.toJSONString(dataFlowLog));
}
}
- }catch (Exception e){
- logger.error("鎶ラ敊鏃ュ織鍑洪敊浜嗭紝",e);
+ } catch (Exception e) {
+ logger.error("鎶ラ敊鏃ュ織鍑洪敊浜嗭紝", e);
}
}
/**
* 淇濆瓨鑰楁椂淇℃伅
+ *
* @param businessServiceDataFlow
*/
- private void saveCostTimeLogMessage(BusinessServiceDataFlow businessServiceDataFlow){
- try{
- if(MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_COST_TIME_ON_OFF))){
+ private void saveCostTimeLogMessage(BusinessServiceDataFlow businessServiceDataFlow) {
+ try {
+ if (MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_COST_TIME_ON_OFF))) {
List<DataFlowLinksCost> dataFlowLinksCosts = businessServiceDataFlow.getLinksCostDates();
JSONObject costDate = new JSONObject();
JSONArray costDates = new JSONArray();
JSONObject newObj = null;
- for(DataFlowLinksCost dataFlowLinksCost : dataFlowLinksCosts){
+ for (DataFlowLinksCost dataFlowLinksCost : dataFlowLinksCosts) {
newObj = JSONObject.parseObject(JSONObject.toJSONString(dataFlowLinksCost));
- newObj.put("dataFlowId",businessServiceDataFlow.getDataFlowId());
- newObj.put("transactionId",businessServiceDataFlow.getTransactionId());
+ newObj.put("dataFlowId", businessServiceDataFlow.getDataFlowId());
+ newObj.put("transactionId", businessServiceDataFlow.getTransactionId());
costDates.add(newObj);
}
- costDate.put("costDates",costDates);
+ costDate.put("costDates", costDates);
- KafkaFactory.sendKafkaMessage(KafkaConstant.TOPIC_COST_TIME_LOG_NAME,"",costDate.toJSONString());
+ KafkaFactory.sendKafkaMessage(KafkaConstant.TOPIC_COST_TIME_LOG_NAME, "", costDate.toJSONString());
}
- }catch (Exception e){
- logger.error("鎶ラ敊鏃ュ織鍑洪敊浜嗭紝",e);
+ } catch (Exception e) {
+ logger.error("鎶ラ敊鏃ュ織鍑洪敊浜嗭紝", e);
}
}
}
--
Gitblit v1.8.0