Browse Source

调整站内信消息传输的格式。

yujia 7 years ago
parent
commit
ee191688ea

+ 5 - 14
src/main/java/com/uas/platform/b2c/common/psmessage/task/MessageTask.java

@@ -10,7 +10,6 @@ import com.uas.platform.b2c.common.psmessage.dao.OrderCompleteInfoDao;
 import com.uas.platform.b2c.common.psmessage.model.OrderCompleteInfo;
 import com.uas.platform.b2c.common.psmessage.service.MessageService;
 import com.uas.platform.b2c.core.config.SysConf;
-import com.uas.platform.b2c.core.constant.SplitChar;
 import com.uas.platform.b2c.trade.order.StringConstant.StringFormat;
 import com.uas.platform.b2c.trade.order.model.MessageNotifyPersonalManagement;
 import com.uas.platform.b2c.trade.order.service.MessageNotifyPersonalManagementService;
@@ -63,24 +62,16 @@ public class MessageTask {
             adminUu = enterpriseInfo.getEnAdminuu();
         }
         if (CollectionUtils.isNotEmpty(managements)) {
-            MessageNotifyPersonalManagement messageNotifyPersonalManagement = managements.get(0);
             if (CollectionUtils.isNotEmpty(completeInfos)) {
                 for (OrderCompleteInfo completeInfo : completeInfos) {
                     String orderId = completeInfo.getOrderId();
                     if (!StringUtils.isEmpty(orderId)) {
-                        String notifyPersonalUseruu = messageNotifyPersonalManagement.getNotifyPersonalUseruu();
-                        if (!StringUtils.isEmpty(notifyPersonalUseruu)) {
-                            String[] userUus = notifyPersonalUseruu.split(SplitChar.HYPHEN);
-                            for (String userUu : userUus) {
-                                try {
-                                    Long useruu = Long.valueOf(userUu);
-                                    MessageModel model = messageService.initMessage(String.format(StringFormat.APPLYPAID, orderId), MessageType.APPLY_PAID.getType(), useruu, sysConf.getEnUU(), ConsumerType.SINGLE, ConsumerApp.MALL, SMSType.DONT_SEND, completeInfo.getRemark(), adminUu, sysConf.getEnUU());
-                                    sendMessageList.add(model);
-                                } catch (NumberFormatException e) {
-                                    e.printStackTrace();
-                                }
-                            }
+                        for (MessageNotifyPersonalManagement management : managements) {
+                            Long notifyPersonalUseruu = management.getNotifyPersonalUseruu();
+                            MessageModel model = messageService.initMessage(String.format(StringFormat.APPLYPAID, orderId), MessageType.APPLY_PAID.getType(), notifyPersonalUseruu, sysConf.getEnUU(), ConsumerType.SINGLE, ConsumerApp.MALL, SMSType.DONT_SEND, completeInfo.getRemark(), adminUu, sysConf.getEnUU());
+                            sendMessageList.add(model);
                         }
+
                     }
                 }
             }

+ 6 - 12
src/main/java/com/uas/platform/b2c/fa/settlement/service/impl/SettlementServiceImpl.java

@@ -353,20 +353,14 @@ public class SettlementServiceImpl implements SettlementService {
 		List<MessageNotifyPersonalManagement> notifyPersonalEnuuAndType = messageNotifyPersonalManagementService.findNotifyPersonalEnuuAndType(sysConf.getEnUU(), MessageType.FINANCIAL_SETTLEMENT.getType());
 		if (org.apache.commons.collections.CollectionUtils.isNotEmpty(notifyPersonalEnuuAndType)) {
 			List<MessageModel> sendMessageModel = new ArrayList<>();
-			MessageNotifyPersonalManagement management = notifyPersonalEnuuAndType.get(0);
-			String notifyPersonalUseruu = management.getNotifyPersonalUseruu();
-			if (!StringUtils.isEmpty(notifyPersonalUseruu)) {
-				String[] useruus = notifyPersonalUseruu.split(SplitChar.HYPHEN);
-				for (String useruu : useruus) {
-					try {
-						Long uu = Long.valueOf(useruu);
-						MessageModel model = messageService.initMessage(String.format(StringFormat.FINANCIAL_SETTLEMENT, paymentId), MessageType.FINANCIAL_SETTLEMENT.getType(), uu, sysConf.getEnUU(), ConsumerType.SINGLE, ConsumerApp.MALL, SMSType.DONT_SEND, "");
-						sendMessageModel.add(model);
-					} catch (NumberFormatException e) {
-						e.printStackTrace();
-					}
+			for (MessageNotifyPersonalManagement messageNotifyPersonalManagement : notifyPersonalEnuuAndType) {
+				Long notifyPersonalUseruu = messageNotifyPersonalManagement.getNotifyPersonalUseruu();
+				if (notifyPersonalEnuuAndType != null) {
+					MessageModel model = messageService.initMessage(String.format(StringFormat.FINANCIAL_SETTLEMENT, paymentId), MessageType.FINANCIAL_SETTLEMENT.getType(), notifyPersonalUseruu, sysConf.getEnUU(), ConsumerType.SINGLE, ConsumerApp.MALL, SMSType.DONT_SEND, "");
+					sendMessageModel.add(model);
 				}
 			}
+
 			if (org.apache.commons.collections.CollectionUtils.isNotEmpty(sendMessageModel)) {
 				messageService.sendMessage(sendMessageModel);
 			}

+ 5 - 5
src/main/java/com/uas/platform/b2c/trade/order/model/MessageNotifyPersonalManagement.java

@@ -20,13 +20,13 @@ public class MessageNotifyPersonalManagement implements Serializable {
     /**
      * 通知人员uu号管理,如果是多人,用中划线隔开
      */
-    @Column(name = "mnpm_notify_personal_useruu", length = 2000)
-    private String notifyPersonalUseruu;
+    @Column(name = "mnpm_notify_personal_useruu")
+    private Long notifyPersonalUseruu;
 
     /**
      * 通知人员名称管理
      */
-    @Column(name = "mnpm_notify_personal_username", length = 2000)
+    @Column(name = "mnpm_notify_personal_username", length = 50)
     private String notifyPersonalUserName;
 
     /**
@@ -62,11 +62,11 @@ public class MessageNotifyPersonalManagement implements Serializable {
         return this;
     }
 
-    public String getNotifyPersonalUseruu() {
+    public Long getNotifyPersonalUseruu() {
         return notifyPersonalUseruu;
     }
 
-    public MessageNotifyPersonalManagement setNotifyPersonalUseruu(String notifyPersonalUseruu) {
+    public MessageNotifyPersonalManagement setNotifyPersonalUseruu(Long notifyPersonalUseruu) {
         this.notifyPersonalUseruu = notifyPersonalUseruu;
         return this;
     }

+ 6 - 18
src/main/java/com/uas/platform/b2c/trade/order/service/impl/OrderServiceImpl.java

@@ -3455,29 +3455,17 @@ public class OrderServiceImpl implements OrderService {
         }
         List<MessageNotifyPersonalManagement> notifyPersonalManagements = messageNotifyPersonalManagementService.findNotifyPersonalEnuuAndType(sysConf.getEnUU(), com.uas.platform.b2c.trade.order.type.MessageType.CONFIRM_PAID.getType());
         if (org.apache.commons.collections.CollectionUtils.isNotEmpty(notifyPersonalManagements)) {
-            MessageNotifyPersonalManagement notifyPersonalManagement = notifyPersonalManagements.get(0);
-            String notifyPersonalUseruu = notifyPersonalManagement.getNotifyPersonalUseruu();
-            if (StringUtils.isEmpty(notifyPersonalUseruu)) {
-                return ;
-            }
-            String[] users = notifyPersonalUseruu.split(SplitChar.HYPHEN);
-            List<MessageModel> list = new ArrayList<>();
-            MessageModel model = null;
-            Long useruu = null;
-            for (String user : users) {
-                try {
-                    useruu = Long.valueOf(user);
-                } catch (NumberFormatException e) {
-                    e.printStackTrace();
-                    continue;
-                }
-                if (useruu != null) {
-                    model = messageService.initMessage(String.format(StringFormat.CONFIRMPAID, order.getOrderid()), com.uas.platform.b2c.trade.order.type.MessageType.CONFIRM_PAID.getType(), useruu, sysConf.getEnUU(), ConsumerType.SINGLE, ConsumerApp.MALL, SMSType.DONT_SEND, "");
+            ArrayList<MessageModel> list = new ArrayList<>();
+            for (MessageNotifyPersonalManagement management : notifyPersonalManagements) {
+                Long notifyPersonalUseruu = management.getNotifyPersonalUseruu();
+                if (notifyPersonalUseruu != null) {
+                    MessageModel model = messageService.initMessage(String.format(StringFormat.CONFIRMPAID, order.getOrderid()), com.uas.platform.b2c.trade.order.type.MessageType.CONFIRM_PAID.getType(), notifyPersonalUseruu, sysConf.getEnUU(), ConsumerType.SINGLE, ConsumerApp.MALL, SMSType.DONT_SEND, "");
                     if (model != null) {
                         list.add(model);
                     }
                 }
             }
+
             if (org.apache.commons.collections.CollectionUtils.isNotEmpty(list)) {
                 messageService.sendMessage(list);
             }