From afe3952e5fbf565cba6a2e4da82eec89f383fd4c Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期一, 22 一月 2024 22:20:17 +0800
Subject: [PATCH] 优化代码
---
service-job/src/main/java/com/java110/job/msgNotify/MsgNotifyFactory.java | 267 +++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 247 insertions(+), 20 deletions(-)
diff --git a/service-job/src/main/java/com/java110/job/msgNotify/MsgNotifyFactory.java b/service-job/src/main/java/com/java110/job/msgNotify/MsgNotifyFactory.java
index dc62e52..220caef 100644
--- a/service-job/src/main/java/com/java110/job/msgNotify/MsgNotifyFactory.java
+++ b/service-job/src/main/java/com/java110/job/msgNotify/MsgNotifyFactory.java
@@ -1,16 +1,22 @@
package com.java110.job.msgNotify;
import com.alibaba.fastjson.JSONObject;
+import com.java110.core.log.LoggerFactory;
+import com.java110.job.adapt.Repair.MachineAddOwnerRepairAdapt;
import com.java110.utils.cache.MappingCache;
import com.java110.utils.constant.MappingConstant;
import com.java110.utils.factory.ApplicationContextFactory;
import com.java110.utils.util.StringUtil;
import com.java110.vo.ResultVo;
+import org.slf4j.Logger;
+
+import java.util.List;
/**
* 娑堟伅閫氱煡宸ュ叿绫�
*/
public class MsgNotifyFactory {
+ private static Logger logger = LoggerFactory.getLogger(MsgNotifyFactory.class);
public static final String DEFAULT_MSG_NOTIFY_WAY = "DEFAULT_MSG_NOTIFY_WAY";
@@ -32,8 +38,17 @@
* @return
*/
public static ResultVo sendApplyReturnFeeMsg(String communityId, String userId, JSONObject content) {
- IMsgNotify msgNotify = getMsgNotify();
- return msgNotify.sendApplyReturnFeeMsg(communityId, userId, content);
+ ResultVo resultVo = null;
+ try {
+ IMsgNotify msgNotify = getMsgNotify();
+ resultVo = msgNotify.sendApplyReturnFeeMsg(communityId, userId, content);
+ } catch (Exception e) {
+ e.printStackTrace();
+ logger.error("閫氱煡 鐢宠閫�璐� 娑堟伅", e);
+ resultVo = new ResultVo(ResultVo.CODE_ERROR, e.getMessage());
+ }
+
+ return resultVo;
}
/**
@@ -41,17 +56,43 @@
*
* @param communityId 灏忓尯
* @param userId 鐢ㄦ埛
- * @param content {
+ * @param contents [{
* "feeTypeName",
* "payerObjName",
* "billAmountOwed",
* "date",
* url
- * }
+ * }]
*/
- public static ResultVo sendOweFeeMsg(String communityId, String userId, JSONObject content) {
- IMsgNotify msgNotify = getMsgNotify();
- return msgNotify.sendOweFeeMsg(communityId, userId, content);
+ public static ResultVo sendOweFeeMsg(String communityId, String userId, String ownerId, List<JSONObject> contents, String notifyWay) {
+ ResultVo resultVo = null;
+ try {
+ IMsgNotify msgNotify = getMsgNotify(notifyWay);
+ resultVo = msgNotify.sendOweFeeMsg(communityId, userId,ownerId, contents);
+ } catch (Exception e) {
+ e.printStackTrace();
+ logger.error("閫氱煡 鍙戦�佹瑺璐� 璐﹀崟淇℃伅 娑堟伅", e);
+ resultVo = new ResultVo(ResultVo.CODE_ERROR, e.getMessage());
+ }
+
+ return resultVo;
+ }
+
+ /**
+ * 鍙戦�佹瑺璐� 璐﹀崟淇℃伅
+ *
+ * @param communityId 灏忓尯
+ * @param userId 鐢ㄦ埛
+ * @param contents [{
+ * "feeTypeName",
+ * "payerObjName",
+ * "billAmountOwed",
+ * "date",
+ * url
+ * }]
+ */
+ public static ResultVo sendOweFeeMsg(String communityId, String userId,String ownerId, List<JSONObject> contents) {
+ return sendOweFeeMsg(communityId,userId, ownerId,contents,null);
}
/**
@@ -68,25 +109,210 @@
* }
*/
public static ResultVo sendPayFeeMsg(String communityId, String userId, JSONObject content, String role) {
- IMsgNotify msgNotify = getMsgNotify();
- return msgNotify.sendPayFeeMsg(communityId, userId, content, role);
+ ResultVo resultVo = null;
+ try {
+ IMsgNotify msgNotify = getMsgNotify();
+ resultVo = msgNotify.sendPayFeeMsg(communityId, userId, content, role);
+ } catch (Exception e) {
+ e.printStackTrace();
+ logger.error("閫氱煡 鍙戦�佺即璐规垚鍔熸彁閱� 娑堟伅", e);
+ resultVo = new ResultVo(ResultVo.CODE_ERROR, e.getMessage());
+ }
+
+ return resultVo;
}
/**
* 涓氫富鎶ヤ慨鏃�
+ *
* @param communityId 灏忓尯
- * @param userId 鐢ㄦ埛
- * @param content {
- * repairTypeName锛�
- * repairObjName锛�
- * repairName锛�
- * url
- * }
+ * @param userId 鐢ㄦ埛
+ * @param content {
+ * repairId,
+ * repairTypeName锛�
+ * repairObjName锛�
+ * repairName锛�
+ * url
+ * }
* @return
*/
- public static ResultVo sendAddOwnerRepairMsg(String communityId,String userId,JSONObject content){
- IMsgNotify msgNotify = getMsgNotify();
- return msgNotify.sendAddOwnerRepairMsg(communityId, userId, content);
+ public static ResultVo sendAddOwnerRepairMsg(String communityId, String userId, JSONObject content) {
+ ResultVo resultVo = null;
+ try {
+ IMsgNotify msgNotify = getMsgNotify();
+ resultVo = msgNotify.sendAddOwnerRepairMsg(communityId, userId, content);
+ } catch (Exception e) {
+ e.printStackTrace();
+ logger.error("閫氱煡 涓氫富鎶ヤ慨鏃� 娑堟伅", e);
+ resultVo = new ResultVo(ResultVo.CODE_ERROR, e.getMessage());
+ }
+
+ return resultVo;
+ }
+
+ /**
+ * 娲惧崟缁欑淮淇笀鍌�
+ *
+ * @param communityId 灏忓尯
+ * @param userId 鐢ㄦ埛
+ * @param content {
+ * repairId,
+ * repairName锛�
+ * tel锛�
+ * time锛�
+ * address
+ * }
+ * @return
+ */
+ public static ResultVo sendDistributeRepairStaffMsg(String communityId, String userId, JSONObject content) {
+ ResultVo resultVo = null;
+ try {
+ IMsgNotify msgNotify = getMsgNotify();
+ resultVo = msgNotify.sendDistributeRepairStaffMsg(communityId, userId, content);
+ } catch (Exception e) {
+ e.printStackTrace();
+ logger.error("閫氱煡 娲惧崟缁欑淮淇笀鍌� 娑堟伅", e);
+ resultVo = new ResultVo(ResultVo.CODE_ERROR, e.getMessage());
+ }
+
+ return resultVo;
+ }
+
+ /**
+ * 娲惧崟缁欎笟涓婚�氱煡
+ *
+ * @param communityId 灏忓尯
+ * @param userId 鐢ㄦ埛
+ * @param content {
+ * name锛�
+ * tel锛�
+ * time锛�
+ * url
+ * }
+ * @return
+ */
+ public static ResultVo sendDistributeRepairOwnerMsg(String communityId, String userId, JSONObject content) {
+ ResultVo resultVo = null;
+ try {
+ IMsgNotify msgNotify = getMsgNotify();
+ resultVo = msgNotify.sendDistributeRepairOwnerMsg(communityId, userId, content);
+ } catch (Exception e) {
+ e.printStackTrace();
+ logger.error("閫氱煡 娲惧崟缁欑淮淇笀鍌� 娑堟伅", e);
+ resultVo = new ResultVo(ResultVo.CODE_ERROR, e.getMessage());
+ }
+
+ return resultVo;
+ }
+
+ /**
+ * 鎶ヤ慨瀹屾垚缁欎笟涓婚�氱煡
+ *
+ * @param communityId 灏忓尯
+ * @param userId 鐢ㄦ埛
+ * @param content {
+ * repairObjName锛�
+ * staffName锛�
+ * time锛�
+ * url
+ * }
+ * @return
+ */
+ public static ResultVo sendFinishRepairOwnerMsg(String communityId, String userId, JSONObject content) {
+ ResultVo resultVo = null;
+ try {
+ IMsgNotify msgNotify = getMsgNotify();
+ resultVo = msgNotify.sendFinishRepairOwnerMsg(communityId, userId, content);
+ } catch (Exception e) {
+ e.printStackTrace();
+ logger.error("閫氱煡 鎶ヤ慨瀹屾垚缁欎笟涓婚�氱煡 娑堟伅", e);
+ resultVo = new ResultVo(ResultVo.CODE_ERROR, e.getMessage());
+ }
+
+ return resultVo;
+ }
+
+
+ /**
+ * 閫�鍗曠粰涓氫富鍙戦�佹秷鎭�
+ *
+ * @param communityId 灏忓尯
+ * @param userId 鐢ㄦ埛
+ * @param content {
+ * repairId,
+ * repairTypeName锛�
+ * repairObjName锛�
+ * repairName锛�
+ * url
+ * }
+ * @return
+ */
+ public static ResultVo sendReturnRepairMsg(String communityId, String userId, JSONObject content) {
+ ResultVo resultVo = null;
+ try {
+ IMsgNotify msgNotify = getMsgNotify();
+ resultVo = msgNotify.sendReturnRepairMsg(communityId, userId, content);
+ } catch (Exception e) {
+ e.printStackTrace();
+ logger.error("閫氱煡 涓氫富鎶ヤ慨鏃� 娑堟伅", e);
+ resultVo = new ResultVo(ResultVo.CODE_ERROR, e.getMessage());
+ }
+
+ return resultVo;
+ }
+
+
+ /**
+ * oa 娴佺▼寰呭鎵归�氱煡
+ *
+ * @param communityId 灏忓尯
+ * @param userId 鐢ㄦ埛
+ * @param content {
+ * flowName锛�
+ * create_user_name锛�
+ * create_time锛�
+ * url
+ * }
+ * @return
+ */
+ public static ResultVo sendOaDistributeMsg(String communityId, String userId, JSONObject content) {
+ ResultVo resultVo = null;
+ try {
+ IMsgNotify msgNotify = getMsgNotify();
+ resultVo = msgNotify.sendOaDistributeMsg(communityId, userId, content);
+ } catch (Exception e) {
+ e.printStackTrace();
+ logger.error("閫氱煡 涓氫富鎶ヤ慨鏃� 娑堟伅", e);
+ resultVo = new ResultVo(ResultVo.CODE_ERROR, e.getMessage());
+ }
+
+ return resultVo;
+ }
+
+ /**
+ * oa 娴佺▼閫氱煡鍙戣捣浜�
+ *
+ * @param communityId 灏忓尯
+ * @param userId 鐢ㄦ埛
+ * @param content {
+ * flowName锛�
+ * staffName锛�
+ * url
+ * }
+ * @return
+ */
+ public static ResultVo sendOaCreateStaffMsg(String communityId, String userId, JSONObject content) {
+ ResultVo resultVo = null;
+ try {
+ IMsgNotify msgNotify = getMsgNotify();
+ resultVo = msgNotify.sendOaCreateStaffMsg(communityId, userId, content);
+ } catch (Exception e) {
+ e.printStackTrace();
+ logger.error("閫氱煡 涓氫富鎶ヤ慨鏃� 娑堟伅", e);
+ resultVo = new ResultVo(ResultVo.CODE_ERROR, e.getMessage());
+ }
+
+ return resultVo;
}
/**
@@ -98,13 +324,14 @@
return getMsgNotify(null);
}
+
/**
* 鑾峰彇閫氱煡閫傞厤鍣�
*
* @param notifyWay
* @return
*/
- private static IMsgNotify getMsgNotify(String notifyWay) {
+ public static IMsgNotify getMsgNotify(String notifyWay) {
IMsgNotify notify = null;
if (StringUtil.isEmpty(notifyWay)) {
notifyWay = MappingCache.getValue(MappingConstant.ENV_DOMAIN, DEFAULT_MSG_NOTIFY_WAY);
--
Gitblit v1.8.0